Re: [PATCH v19 4/4] power: wm831x_power: Support USB charger current limit management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Baolin,

[auto build test ERROR on v4.9-rc8]
[cannot apply to balbi-usb/next usb/usb-testing battery/master next-20170220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Baolin-Wang/Introduce-usb-charger-framework-to-deal-with-the-usb-gadget-power-negotation/20170220-173051
config: i386-randconfig-x017-201708 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from drivers/power/supply/wm831x_power.c:16:0:
   include/linux/usb/charger.h: In function 'usb_charger_get_state':
   include/linux/usb/charger.h:151:9: error: 'USB_CHARGER_REMOVE' undeclared (first use in this function)
     return USB_CHARGER_REMOVE;
            ^~~~~~~~~~~~~~~~~~
   include/linux/usb/charger.h:151:9: note: each undeclared identifier is reported only once for each function it appears in
   drivers/power/supply/wm831x_power.c: In function 'wm831x_usb_limit_change':
>> drivers/power/supply/wm831x_power.c:151:2: error: 'best' undeclared (first use in this function)
     best = 0;
     ^~~~
>> drivers/power/supply/wm831x_power.c:152:7: error: 'i' undeclared (first use in this function)
     for (i = 0; i < ARRAY_SIZE(wm831x_usb_limits); i++) {
          ^

vim +/best +151 drivers/power/supply/wm831x_power.c

    10	
    11	#include <linux/module.h>
    12	#include <linux/err.h>
    13	#include <linux/platform_device.h>
    14	#include <linux/power_supply.h>
    15	#include <linux/slab.h>
  > 16	#include <linux/usb/charger.h>
    17	
    18	#include <linux/mfd/wm831x/core.h>
    19	#include <linux/mfd/wm831x/auxadc.h>
    20	#include <linux/mfd/wm831x/pmu.h>
    21	#include <linux/mfd/wm831x/pdata.h>
    22	
    23	struct wm831x_power {
    24		struct wm831x *wm831x;
    25		struct power_supply *wall;
    26		struct power_supply *usb;
    27		struct power_supply *battery;
    28		struct power_supply_desc wall_desc;
    29		struct power_supply_desc usb_desc;
    30		struct power_supply_desc battery_desc;
    31		char wall_name[20];
    32		char usb_name[20];
    33		char battery_name[20];
    34		bool have_battery;
    35		struct usb_charger *usb_charger;
    36		struct notifier_block usb_notify;
    37	};
    38	
    39	static int wm831x_power_check_online(struct wm831x *wm831x, int supply,
    40					     union power_supply_propval *val)
    41	{
    42		int ret;
    43	
    44		ret = wm831x_reg_read(wm831x, WM831X_SYSTEM_STATUS);
    45		if (ret < 0)
    46			return ret;
    47	
    48		if (ret & supply)
    49			val->intval = 1;
    50		else
    51			val->intval = 0;
    52	
    53		return 0;
    54	}
    55	
    56	static int wm831x_power_read_voltage(struct wm831x *wm831x,
    57					     enum wm831x_auxadc src,
    58					     union power_supply_propval *val)
    59	{
    60		int ret;
    61	
    62		ret = wm831x_auxadc_read_uv(wm831x, src);
    63		if (ret >= 0)
    64			val->intval = ret;
    65	
    66		return ret;
    67	}
    68	
    69	/*********************************************************************
    70	 *		WALL Power
    71	 *********************************************************************/
    72	static int wm831x_wall_get_prop(struct power_supply *psy,
    73					enum power_supply_property psp,
    74					union power_supply_propval *val)
    75	{
    76		struct wm831x_power *wm831x_power = dev_get_drvdata(psy->dev.parent);
    77		struct wm831x *wm831x = wm831x_power->wm831x;
    78		int ret = 0;
    79	
    80		switch (psp) {
    81		case POWER_SUPPLY_PROP_ONLINE:
    82			ret = wm831x_power_check_online(wm831x, WM831X_PWR_WALL, val);
    83			break;
    84		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
    85			ret = wm831x_power_read_voltage(wm831x, WM831X_AUX_WALL, val);
    86			break;
    87		default:
    88			ret = -EINVAL;
    89			break;
    90		}
    91	
    92		return ret;
    93	}
    94	
    95	static enum power_supply_property wm831x_wall_props[] = {
    96		POWER_SUPPLY_PROP_ONLINE,
    97		POWER_SUPPLY_PROP_VOLTAGE_NOW,
    98	};
    99	
   100	/*********************************************************************
   101	 *		USB Power
   102	 *********************************************************************/
   103	static int wm831x_usb_get_prop(struct power_supply *psy,
   104				       enum power_supply_property psp,
   105				       union power_supply_propval *val)
   106	{
   107		struct wm831x_power *wm831x_power = dev_get_drvdata(psy->dev.parent);
   108		struct wm831x *wm831x = wm831x_power->wm831x;
   109		int ret = 0;
   110	
   111		switch (psp) {
   112		case POWER_SUPPLY_PROP_ONLINE:
   113			ret = wm831x_power_check_online(wm831x, WM831X_PWR_USB, val);
   114			break;
   115		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
   116			ret = wm831x_power_read_voltage(wm831x, WM831X_AUX_USB, val);
   117			break;
   118		default:
   119			ret = -EINVAL;
   120			break;
   121		}
   122	
   123		return ret;
   124	}
   125	
   126	static enum power_supply_property wm831x_usb_props[] = {
   127		POWER_SUPPLY_PROP_ONLINE,
   128		POWER_SUPPLY_PROP_VOLTAGE_NOW,
   129	};
   130	
   131	/* In milliamps */
   132	static const unsigned int wm831x_usb_limits[] = {
   133		0,
   134		2,
   135		100,
   136		500,
   137		900,
   138		1500,
   139		1800,
   140		550,
   141	};
   142	
   143	static int wm831x_usb_limit_change(struct notifier_block *nb,
   144					   unsigned long limit, void *data)
   145	{
   146		struct wm831x_power *wm831x_power = container_of(nb,
   147								 struct wm831x_power,
   148								 usb_notify);
   149	
   150		/* Find the highest supported limit */
 > 151		best = 0;
 > 152		for (i = 0; i < ARRAY_SIZE(wm831x_usb_limits); i++) {
   153			if (limit >= wm831x_usb_limits[i] &&
   154			    wm831x_usb_limits[best] < wm831x_usb_limits[i])
   155				best = i;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux