Commit Graph

18 Commits

Author SHA1 Message Date
Heikki Krogerus fcc8ebc990 power_supply: Convert all users to new usb_phy
Use the new usb_phy_* functions instead of the old
otg_* ones.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-13 13:53:21 +02:00
Heikki Krogerus 8675381109 usb: otg: Rename otg_transceiver to usb_phy
This is the first step in separating USB transceivers from
USB OTG utilities.

Includes fixes to IMX code from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Acked-by: Li Yang <leoli@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-13 13:34:36 +02:00
Axel Lin 300bac7fb8 power_supply: Convert drivers/power/* to use module_platform_driver()
This patch converts the drivers in drivers/power/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Nithish Mahalingam <nithish.mahalingam@intel.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Balaji Rao <balajirrao@openmoko.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Clifton Barnes <cabarnes@indesign-llc.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 09:12:07 +04:00
Axel Lin 1c74529dbe pda_power: Fix build error if !CONFIG_USB_OTG_UTILS
commit 9ad63986c6
"pda_power: Add support for using otg transceiver events"
introduces below build error if !CONFIG_USB_OTG_UTILS.

  CC      drivers/power/pda_power.o
drivers/power/pda_power.c: In function 'pda_power_probe':
drivers/power/pda_power.c:322: error: 'otg_is_usb_online' undeclared (first use in this function)
drivers/power/pda_power.c:322: error: (Each undeclared identifier is reported only once
drivers/power/pda_power.c:322: error: for each function it appears in.)
drivers/power/pda_power.c:325: error: 'otg_is_ac_online' undeclared (first use in this function)
drivers/power/pda_power.c:371: error: 'otg_handle_notification' undeclared (first use in this function)
make[2]: *** [drivers/power/pda_power.o] Error 1
make[1]: *** [drivers/power] Error 2
make: *** [drivers] Error 2

This patch adds #ifdef CONFIG_USB_OTG_UTILS guards at necessary places to fix
build errors.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-08-23 17:31:52 +04:00
Dima Zavin 9ad63986c6 pda_power: Add support for using otg transceiver events
If the platform data sets the use_otg_notifier flag,
the driver will now register an otg notifier callback and listen
to transceiver events for AC/USB plug-in events instead. This would
normally be used by not specifying is_xx_online callbacks and
not specifying any irqs so the state machine is completely driven
from OTG xceiver events.

Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-08-19 21:03:22 +04:00
Daniel Mack a3bcbbee83 pda_power: Add function callbacks for suspend and resume
Add function prototypes for power management events so they can be
handled and used by platform implementations.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-16 19:14:34 +04:00
Philipp Zabel 5bf2b994bf pda_power: Add optional OTG transceiver and voltage regulator support
This patch allows machines to use an OTG transceiver driver instead of
supplying a custom is_usb_online callback to check USB power.
Also, in the case that the OTG transceiver handles charger control when
connected to USB, a regulator named "ac_draw" can be supplied instead of
the custom set_charge callback to control the charger when connected to
AC.

The check for (transceiver->state == OTG_STATE_B_PERIPHERAL) in
otg_is_usb_online is probably too simple, I'm just using this with a
peripheral only device and gpio_vbus + bq24022. I'm not sure which other
OTG states can supply power.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-02-02 20:15:47 +03:00
Philipp Zabel 74194cc710 power_supply: pda_power: Don't request shared IRQs w/ IRQF_DISABLED
IRQF_DISABLED is not guaranteed for shared IRQs. I think power_changed_isr
doesn't need it anyway, as it only fires a timer.
This patch enables IRQF_SAMPLE_RANDOM instead.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-01-26 02:09:26 +03:00
Robert Jarzmik e82374fd1a pda_power: Check and handle return value of set_irq_wake
The recent change in commit 2db873211b
forces the calls enable_irq_wake() and disable_irq_wake() to
be balanced. But if in pda_power_suspend() the call to
enable_irq_wake() fails (because attached gpio cannot wake
up the CPU), the corresponding disable_irq_wake will WARN().
Fix it by storing success/failure of enable_irq_wake().

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2008-09-01 02:10:06 +04:00
Kay Sievers 2f5a5cf93f drivers/power: fix platform driver hotplug/coldplug
Since 43cc71eed1 ("platform: prefix MODALIAS
with "platform:"), the platform modalias is prefixed with "platform:".
Add MODULE_ALIAS() to the hotpluggable "power" drivers drivers, to
re-enable auto loading.

[dbrownell@users.sourceforge.net: one was missing]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:28 -07:00
Philipp Zabel f6b6b180b4 pda_power: add init and exit function callbacks
This adds init/exit function callbacks to pda_power, to
provide a place where the platform code can request/free
GPIOs that it wants to use in the is_ac_online, is_usb_online
and set_charge functions.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2008-05-03 03:39:55 +04:00
Anton Vorontsov c3caebad74 pda_power: implement polling
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
2008-02-02 02:44:34 +03:00
Anton Vorontsov bfde2662ae pda_power: various cleanups
- handle spurious interrupts correctly;
- get rid of pda_power_supplies array, use two variables instead;
- factor out psy_changed() function, it will be used for polling.

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
2008-02-02 02:44:34 +03:00
Dmitry Baryshkov 8f8e9b387e pda_power: add suspend/resume support
Add suspend/resume/wakeup support for pda_power.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
2008-02-02 02:43:00 +03:00
Dmitry Baryshkov 9ef4510626 pda_power: only register available psu
Currently pda-power adds both ac and usb power supply units.
This patch fixes it so that psu are added only if they are enabled.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
2008-02-02 02:42:59 +03:00
Anton Vorontsov 7b3d54a8c3 Power supply class and drivers: remove non obligatory return statements
Per Jeff Garzik request.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
2007-07-15 22:32:38 +04:00
Jeff Garzik 5ebf6e6a96 pda_power: clean up irq, timer
Clean up pda_power interrupt handling:

Prior to this patch, the driver would pass information it needed
to the interrupt handler dev_id pointer, and then prompt forget it
ever did so, recreating that same information after a couple passes
through the timer-based state machine.

This patch removes the redundant checks by passing the
pda_power_supply[] pointer through the state machine.  The current
code passed 'irq' through the state machine, as an index to recreate
the pointer, when we could more simply pass around the pointer itself.

This patch makes it easier to remove the 'irq' argument in the future,
in addition to cleaning up the driver today.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-15 22:32:03 +04:00
Anton Vorontsov b2998049cf [BATTERY] pda_power platform driver
Common power driver for PDAs and phones with one or two external
power supplies (AC/USB) connected to main and backup batteries,
and optional builtin charger.

It's used to stop logic duplication through different embedded
devices. So, power supply *logic* is here. pda_power register
power supplies, and will take care about notifying batteries
about power changes through external power interface.

Currently, power consumption legal limits (including USB power
consumption) should be handled by platform code, inside set_charge
function.

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
Signed-off-by: Roman Moravcik <roman.moravcik@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-10 11:25:59 +01:00