alistair23-linux/include/linux/power/max8903_charger.h
Chris Lapa cbf9077e58 max8903: cleans up confusing relationship between dc_valid, dok and dcm.
The max8903_charger.h file indicated that dcm and dok were not optional
when dc_valid is set.

It makes sense to have dok as a compulsory pin when dc_valid is given.
However dcm can be optionally wired to a fixed level especially when the
circuit is configured for dc power exclusively.

The previous implementation already allowed for this somewhat, however no
error was given if dok wasn't given whilst dc_valid was.

The new implementation enforces dok presence when dc_valid is given. Whilst
allowing dcm to be optional.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00

58 lines
1.7 KiB
C

/*
* max8903_charger.h - Maxim 8903 USB/Adapter Charger Driver
*
* Copyright (C) 2011 Samsung Electronics
* MyungJoo Ham <myungjoo.ham@samsung.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __MAX8903_CHARGER_H__
#define __MAX8903_CHARGER_H__
struct max8903_pdata {
/*
* GPIOs
* cen, chg, flt, dcm and usus are optional.
* dok and uok are not optional depending on the status of
* dc_valid and usb_valid.
*/
int cen; /* Charger Enable input */
int dok; /* DC(Adapter) Power OK output */
int uok; /* USB Power OK output */
int chg; /* Charger status output */
int flt; /* Fault output */
int dcm; /* Current-Limit Mode input (1: DC, 2: USB) */
int usus; /* USB Suspend Input (1: suspended) */
/*
* DC(Adapter/TA) is wired
* When dc_valid is true,
* dok should be valid.
*
* At least one of dc_valid or usb_valid should be true.
*/
bool dc_valid;
/*
* USB is wired
* When usb_valid is true,
* uok should be valid.
*/
bool usb_valid;
};
#endif /* __MAX8903_CHARGER_H__ */