lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Aug 2015 13:20:12 +0800
From:	Peter Chen <peter.chen@...escale.com>
To:	Mark Brown <broonie@...nel.org>
CC:	Baolin Wang <baolin.wang@...aro.org>, <balbi@...com>,
	<linus.walleij@...aro.org>, <linux-kernel@...r.kernel.org>,
	<gregkh@...uxfoundation.org>, <sojka@...ica.cz>,
	<stern@...land.harvard.edu>, <r.baldyga@...sung.com>,
	<yoshihiro.shimoda.uh@...esas.com>, <linux-usb@...r.kernel.org>,
	<device-mainlining@...ts.linuxfoundation.org>, <sre@...nel.org>,
	<dbaryshkov@...il.com>, <dwmw2@...radead.org>,
	<sameo@...ux.intel.com>, <lee.jones@...aro.org>,
	<patches@...nsource.wolfsonmicro.com>, <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v2 3/3] power: wm831x_power: Support USB charger current
 limit management

On Mon, Aug 17, 2015 at 10:26:23AM -0700, Mark Brown wrote:
> On Mon, Aug 17, 2015 at 09:07:08AM +0800, Peter Chen wrote:
> > On Fri, Aug 14, 2015 at 05:47:46PM +0800, Baolin Wang wrote:
> 
> > > +	1500,
> > > +	1800,
> > > +	550,
> > > +};
> 
> > Why 550 is the last, but not 1800?
> 
> You'd have to ask the hardware engineers who designed the chip.  I
> suspect it's because 550 was added at a late stage in the design process
> but I'm basically just guessing there.

ok, I just had suspected below function's correctness, after looking
it again, it always set 1800 as charging limit, does it be expected?

+/* In miliamps */
+static unsigned int wm831x_usb_limits[] = {
+       0,
+       2,
+       100,
+       500,
+       900,
+       1500,
+       1800,
+       550,
+};
+
+static int wm831x_usb_limit_change(struct notifier_block *nb,
+                                  unsigned long limit, void *data)
+{
+       struct wm831x_power *wm831x_power = container_of(nb,
+                                                        struct wm831x_power,
+                                                        usb_notify);
+       int i, best;
+
+       /* Find the highest supported limit */
+       best = 0;
+       for (i = 0; i < ARRAY_SIZE(wm831x_usb_limits); i++) {
+               if (limit < wm831x_usb_limits[i] &&
+                   wm831x_usb_limits[best] < wm831x_usb_limits[i])
+                       best = i;
+       }
+
+       dev_dbg(wm831x_power->wm831x->dev,
+               "Limiting USB current to %dmA", wm831x_usb_limits[best]);
+
+       wm831x_set_bits(wm831x_power->wm831x, WM831X_POWER_STATE,
+                       WM831X_USB_ILIM_MASK, best);
+
+       return 0;
+}
+

> 
> > >   *********************************************************************/
> > > @@ -606,8 +646,31 @@ static int wm831x_power_probe(struct platform_device *pdev)
> > >  		}
> > >  	}
> 
> > > +	if (wm831x_pdata && wm831x_pdata->usb_gadget) {
> 
> > Where the wm831x_pdata->usb_gadget is initialized?
> 
> It's platform data, it will be initialised by whatever registers the
> platform data.

Get it, I just do not find in this patch set, thanks.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ