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, 6 Dec 2011 14:21:31 +0100
From:	Sebastian Reichel <sre@...ian.org>
To:	Felipe Contreras <felipe.contreras@...il.com>
Cc:	Felipe Contreras <felipe.contreras@...ia.com>,
	linux-main <linux-kernel@...r.kernel.org>,
	linux-omap <linux-omap@...r.kernel.org>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Pali Rohár <pali.rohar@...il.com>,
	Aliaksei Katovich <aliaksei.katovich@...ia.com>,
	Vladimir Zapolskiy <vz@...ia.com>
Subject: Re: [PATCH] mfd: add bq2415x charger driver

On Tue, Dec 06, 2011 at 04:49:37AM +0200, Felipe Contreras wrote:
> Not really. There are 6 bits: 640, 320, 160, 80, 40, 20. So values
> from 0 to 1260mV can be represented, at steps of 20mV. A value of 0
> means 3.5V.

I just checked it. You'r driver just writes 0x42 to the register,
which makes use of the described platform specific resistor.

> bq2415x_i2c_write(cli, BQ2415X_CHG_CTL, 0x42);

I know that 42 is the "Answer to the Ultimate Question of Life, the
Universe, and Everything" [0]. But in this case 0x42 is platform
specific. Check page 30 in the specs, From Table 9 onwards.

> > [...]
> >
> >> +     bq2415x_i2c_write(cli, BQ2415X_CHG_CTL, 0x42);
> >> +     bq2415x_set_voltage(cli, 0, 4200000);
> >> +     bq2415x_set_current_limit(cli, 1800000, 1800000);
> >
> > So it always charges with 1.8A? Shouldn't this be dependent on the
> > input source (e.g. 500mA from USB)? Also what's if no charger is
> > connected at all?
> 
> No. I'm hard-coding those values, but I wrote the functions
> (set_voltate, set_current_limit) so all values are supported.
> 
> What is missing is the code to connect this driver to the charger
> detector driver (isp1704), so those values are determined dynamically.

ok, I was talking about the current state ;)

> > Apart from this I think those values should be exposed to sysfs
> > via /sys/class/power_supply.
> 
> Perhaps. Although I don't see much of the power supply interface that
> could be useful here, but if so, I guess this should be indeed in
> 'drivers/power'.

So it may need some new entries. Normal mobile userspace wants to
know at least charging status & speed. Also it's probably a good
idea to make current_limit sysfs entry writeable, so that advanced
users can overwrite a autodetected value (e.g. a dumb wallcharger
may be detected as 100mA, but can provide 1A).

[0] http://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy

-- Sebasitan

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ