linux/drivers/mfd/tps65010.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * tps65010 - driver for tps6501x power management chips
 *
 * Copyright (C) 2004 Texas Instruments
 * Copyright (C) 2004-2005 David Brownell
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>

#include <linux/mfd/tps65010.h>

#include <linux/gpio/driver.h>


/*-------------------------------------------------------------------------*/

#define DRIVER_VERSION
#define DRIVER_NAME

MODULE_DESCRIPTION();
MODULE_LICENSE();

static struct i2c_driver tps65010_driver;

/*-------------------------------------------------------------------------*/

/* This driver handles a family of multipurpose chips, which incorporate
 * voltage regulators, lithium ion/polymer battery charging, GPIOs, LEDs,
 * and other features often needed in portable devices like cell phones
 * or digital cameras.
 *
 * The tps65011 and tps65013 have different voltage settings compared
 * to tps65010 and tps65012.  The tps65013 has a NO_CHG status/irq.
 * All except tps65010 have "wait" mode, possibly defaulted so that
 * battery-insert != device-on.
 *
 * We could distinguish between some models by checking VDCDC1.UVLO or
 * other registers, unless they've been changed already after powerup
 * as part of board setup by a bootloader.
 */
enum tps_model {};

struct tps65010 {};

#define POWER_POLL_DELAY

/*-------------------------------------------------------------------------*/

#if	defined(DEBUG) || defined(CONFIG_DEBUG_FS)

static void dbg_chgstat(char *buf, size_t len, u8 chgstatus)
{}

static void dbg_regstat(char *buf, size_t len, u8 regstatus)
{}

static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
{}

#endif

#ifdef	DEBUG

static void show_chgstatus(const char *label, u8 chgstatus)
{
	char buf [100];

	dbg_chgstat(buf, sizeof buf, chgstatus);
	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}

static void show_regstatus(const char *label, u8 regstatus)
{
	char buf [100];

	dbg_regstat(buf, sizeof buf, regstatus);
	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}

static void show_chgconfig(int por, const char *label, u8 chgconfig)
{
	char buf [100];

	dbg_chgconf(por, buf, sizeof buf, chgconfig);
	pr_debug("%s: %s %s", DRIVER_NAME, label, buf);
}

#else

static inline void show_chgstatus(const char *label, u8 chgstatus) {}
static inline void show_regstatus(const char *label, u8 chgstatus) {}
static inline void show_chgconfig(int por, const char *label, u8 chgconfig) {}

#endif

#ifdef	CONFIG_DEBUG_FS

static int dbg_show(struct seq_file *s, void *_)
{}

static int dbg_tps_open(struct inode *inode, struct file *file)
{}

static const struct file_operations debug_fops =;

#define DEBUG_FOPS

#else
#define DEBUG_FOPS
#endif

/*-------------------------------------------------------------------------*/

/* handle IRQS in a task context, so we can use I2C calls */
static void tps65010_interrupt(struct tps65010 *tps)
{}

/* handle IRQs and polling using keventd for now */
static void tps65010_work(struct work_struct *work)
{}

static irqreturn_t tps65010_irq(int irq, void *_tps)
{}

/*-------------------------------------------------------------------------*/

/* offsets 0..3 == GPIO1..GPIO4
 * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes)
 * offset 6 == vibrator motor driver
 */
static void
tps65010_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{}

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

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


/*-------------------------------------------------------------------------*/

static struct tps65010 *the_tps;

static void tps65010_remove(struct i2c_client *client)
{}

static int tps65010_probe(struct i2c_client *client)
{}

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

static struct i2c_driver tps65010_driver =;

/*-------------------------------------------------------------------------*/

/* Draw from VBUS:
 *   0 mA -- DON'T DRAW (might supply power instead)
 * 100 mA -- usb unit load (slowest charge rate)
 * 500 mA -- usb high power (fast battery charge)
 */
int tps65010_set_vbus_draw(unsigned mA)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65010_set_gpio_out_value parameter:
 * gpio:  GPIO1, GPIO2, GPIO3 or GPIO4
 * value: LOW or HIGH
 */
int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65010_set_led parameter:
 * led:  LED1 or LED2
 * mode: ON, OFF or BLINK
 */
int tps65010_set_led(unsigned led, unsigned mode)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65010_set_vib parameter:
 * value: ON or OFF
 */
int tps65010_set_vib(unsigned value)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65010_set_low_pwr parameter:
 * mode: ON or OFF
 */
int tps65010_set_low_pwr(unsigned mode)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65010_config_vregs1 parameter:
 * value to be written to VREGS1 register
 * Note: The complete register is written, set all bits you need
 */
int tps65010_config_vregs1(unsigned value)
{}
EXPORT_SYMBOL();

int tps65010_config_vdcdc2(unsigned value)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/
/* tps65013_set_low_pwr parameter:
 * mode: ON or OFF
 */

/* FIXME: Assumes AC or USB power is present. Setting AUA bit is not
	required if power supply is through a battery */

int tps65013_set_low_pwr(unsigned mode)
{}
EXPORT_SYMBOL();

/*-------------------------------------------------------------------------*/

static int __init tps_init(void)
{}
/* NOTE:  this MUST be initialized before the other parts of the system
 * that rely on it ... but after the i2c bus on which this relies.
 * That is, much earlier than on PC-type systems, which don't often use
 * I2C as a core system bus.
 */
subsys_initcall(tps_init);

static void __exit tps_exit(void)
{}
module_exit(tps_exit);