Commit Graph

43 Commits

Author SHA1 Message Date
Guodong Xu b8b27a44dd regulator: remove unnecessary of_node_get() to parent
These of_node_get() were added to balance refcount decrements inside of
of_find_node_by_name().
See: commit c92f5dd2c4 ("regulator: Add missing of_node_put()")

However of_find_node_by_name() was then replaced by of_get_child_by_name(),
which doesn't call of_node_put() against its input parameter.

So, need to remove these unnecessary of_node_get() calls.

Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Reviewed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-10 11:35:02 +01:00
Jingoo Han e54f19bff4 regulator: 88pm8607: fix indent code style
Fix indent code style in order to fix the following checkpatch
issues.

  ERROR: code indent should use tabs where possible
  WARNING: please, no space before tabs
  WARNING: please, no spaces at the start of a line

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-27 13:39:29 +09:00
Sachin Kamat ca1e3f33d9 regulator: 88pm8607: Use of_get_child_by_name
of_find_node_by_name walks the allnodes list, and can thus walk
outside of the parent node. Use of_get_child_by_name instead.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-14 21:13:40 +00:00
Axel Lin bcb5fe4487 regulator: 88pm8607: Convert to devm_regulator_register
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:27:55 +01:00
Jingoo Han dff91d0b72 regulator: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-30 12:24:20 +01:00
Axel Lin 405c54009c regulator: Remove all platform_set_drvdata(pdev, NULL) in drivers
Since 0998d06310 "device-core: Ensure drvdata = NULL when no driver is bound",
this is done by driver core after device_release or on probe failure.
Thus we can remove all platform_set_drvdata(pdev, NULL) in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-12 18:34:12 +04:00
Axel Lin 318c658b7c regulator: 88pm8607: Use enable_is_inverted flag with regulator_enable_regmap and friends APIs
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-05 17:56:40 +08:00
Mark Brown cf1466fbf8 Merge remote-tracking branch 'regulator/topic/of' into regulator-next 2013-02-19 12:42:52 +00:00
Axel Lin c92f5dd2c4 regulator: Add missing of_node_put()
of_find_node_by_name() returns a node pointer with refcount incremented, use
of_node_put() on it when done.

of_find_node_by_name() will call of_node_put() against from parameter,
thus we also need to call of_node_get(from) before calling
of_find_node_by_name().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-30 18:50:27 +08:00
Axel Lin c6f0a0efb1 regulator: 88pm8607: Use apply_[reg|bit] with regmap based voltage_sel operations
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:28:25 +00:00
Axel Lin adbf7eabb6 regulator: 88pm8607: Update update_bit for BUCK2 in pm8607_set_voltage_sel
BUCK2 has the update_bit setting, but current code does not set update_bit
in pm8607_set_voltage_sel.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-27 17:28:22 +00:00
Bill Pemberton 8dc995f56e regulator: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20 10:53:38 +09:00
Bill Pemberton a5023574d1 regulator: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20 10:31:26 +09:00
Bill Pemberton 5eb9f2b963 regulator: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20 10:31:19 +09:00
Haojian Zhuang 2e57d56747 mfd: 88pm860x: Device tree support
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-10-02 11:43:13 +02:00
Haojian Zhuang ff13e9e256 mfd: 88pm860x: Avoid to check resource for preg regulator
Since PREG regulator is the only one regulator in 88PM8606, and other
regulators are in 88PM8607. Checking resource as identifying regulator
is not a good way. We can use NULL resource to indentify PREG regulator.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-19 12:39:13 +02:00
Jett.Zhou e7a7810ae0 regulator: 88pm860x: Add pre-regulator support for 88pm860x regulator
Pre-regulator of 88pm8606 is mainly for support charging based on vbus,
it needs to be enabled for charging battery, and will be disabled in
some exception condition like over-temp.
Add the pre-regulator support for 88pm860x regulator driver.

Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-19 12:39:13 +02:00
Haojian Zhuang a70abacb06 mfd: 88pm860x: Use REG resource in regulator
Since IORESOURCE_IO is changed to IORESOURCE_REG in 88pm860x driver,
update self-defined IORESOURCE_IO resource to register offset that
is IORESOURCE_REG in regulator driver. And split regulator platform
data array into scattered platform data.

Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-11 11:38:17 +02:00
Mark Brown 023670295a mfd: 88pm860x: Convert to IORESOURCE_REG
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Tested-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-11 10:15:03 +02:00
Axel Lin c006b21f7f regulator: 88pm8607: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-04 13:32:06 +01:00
Axel Lin ef26e0dbe8 regulator: 88pm8607: Use generic regmap enable/disable operations
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:19:50 +01:00
Mark Brown c172708d38 regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.

The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-09 12:37:09 +01:00
Axel Lin 509cbf848c regulator: Convert 88pm8607 to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Jett Zhou <jtzhou@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:40 +01:00
Axel Lin 4ca1e1d9e1 regulator: Convert 88pm8607 to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Jett Zhou <jtzhou@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:39 +01:00
Axel Lin 53b6949ef3 regulator: Add missing n_voltages setting for 88pm8607
Then we can remove the vol_nbits field from struct pm8607_regulator_info.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Jett Zhou <jtzhou@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:39 +01:00
Axel Lin d3d7bccc07 regulator: Set list_voltage callback for 88pm8607
Current code implements pm8607_list_voltage but does not set the list_voltage
callback function in pm8607_regulator_ops. Fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Tested-by: Jett Zhou <jtzhou@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:38 +01:00
Jett.Zhou 3380643b0e regulator: fix the ldo configure according to 88pm860x spec
Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-02-24 14:56:32 +00:00
Rajendra Nayak 2c043bcbf2 regulator: pass additional of_node to regulator_register()
With device tree support for regulators, its needed that the
regulator_dev->dev device has the right of_node attached.
To be able to do this add an additional parameter to the
regulator_register() api, wherein the dt-adapted driver can
then pass this additional info onto the regulator core.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:47:04 +00:00
Linus Torvalds 32aaeffbd4 Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
  Revert "tracing: Include module.h in define_trace.h"
  irq: don't put module.h into irq.h for tracking irqgen modules.
  bluetooth: macroize two small inlines to avoid module.h
  ip_vs.h: fix implicit use of module_get/module_put from module.h
  nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
  include: replace linux/module.h with "struct module" wherever possible
  include: convert various register fcns to macros to avoid include chaining
  crypto.h: remove unused crypto_tfm_alg_modname() inline
  uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
  pm_runtime.h: explicitly requires notifier.h
  linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
  miscdevice.h: fix up implicit use of lists and types
  stop_machine.h: fix implicit use of smp.h for smp_processor_id
  of: fix implicit use of errno.h in include/linux/of.h
  of_platform.h: delete needless include <linux/module.h>
  acpi: remove module.h include from platform/aclinux.h
  miscdevice.h: delete unnecessary inclusion of module.h
  device_cgroup.h: delete needless include <linux/module.h>
  net: sch_generic remove redundant use of <linux/module.h>
  net: inet_timewait_sock doesnt need <linux/module.h>
  ...

Fix up trivial conflicts (other header files, and  removal of the ab3550 mfd driver) in
 - drivers/media/dvb/frontends/dibx000_common.c
 - drivers/media/video/{mt9m111.c,ov6650.c}
 - drivers/mfd/ab3550-core.c
 - include/linux/dmaengine.h
2011-11-06 19:44:47 -08:00
Paul Gortmaker 65602c32ee regulator: Add module.h to drivers/regulator users as required
Another group of drivers that are taking advantage of the implicit
presence of module.h -- and will break when we pull the carpet out
from under them during a cleanup.  Fix 'em now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:15 -04:00
Axel Lin 99cd25ce10 regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched
In the case of no id is matched, the variable i is equal to
ARRAY_SIZE(pm8607_regulator_info).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-08-08 17:15:08 +01:00
Randy Dunlap 099691081d regulator: Fix 88pm8607.c printk format warning
Fix printk format warning (seen on x86_64) and change to unsigned
output format:

drivers/regulator/88pm8607.c:417: warning: format '%d' expects type 'int', but argument 3 has type 'resource_size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:47:29 +02:00
Haojian Zhuang 586e1a1763 mfd: Avoid to use constraint name in 88pm860x regulator driver
Avoid to use constraint name in regulator driver. So use regulator id is used
instead in platform driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:38 +02:00
Samuel Ortiz 07259a7092 mfd: Use mfd cell platform_data for 88pm860x cells platform bits
With the addition of a platform device mfd_cell pointer, MFD drivers
can go back to passing platform back to their sub drivers.
This allows for an mfd_cell->mfd_data removal and thus keep the
sub drivers MFD agnostic. This is mostly needed for non MFD aware
sub drivers.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:12 +02:00
Haojian Zhuang 22aad0011e mfd: Adopt mfd_data in 88pm860x regulator
Copy 88pm860x platform data into different mfd_data structure for
regulator driver. So move the identification of device node from
regulator driver to mfd driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-23 10:42:06 +01:00
Mark Brown 3a93f2a9f4 regulator: Report actual configured voltage to set_voltage()
Change the interface used by set_voltage() to report the selected value
to the regulator core in terms of a selector used by list_voltage().
This allows the regulator core to know the voltage that was chosen
without having to do an explict get_voltage(), which would be much more
expensive as it will generally access hardware.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12 14:32:59 +00:00
Axel Lin d06563cb86 regulator: 88pm8607 - fix value range checking for accessing info->vol_table
In choose_voltage(), we use i as array index of info->vol_table.
The valid value range for i should be 0 .. ARRAY_SIZE(info->vol_table) - 1.

Take LDO1 as example, ARRAY_SIZE(LDO1_table) is 4, vol_nbits of LDO1 is 2.
for (i = 0; i < (2 << info->vol_nbits); i++)  is equivalent to
for (i = 0; i < 8; i++)
which is wrong.

The same value range checking also applies for index in pm8607_list_voltage().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@openource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-09-05 11:15:52 +01:00
Haojian Zhuang 9f79e9db2e regulator: use voltage number array in 88pm860x
A lot of condition comparision statements are used in original driver. These
statements are used to check the boundary of voltage numbers since voltage
number isn't linear.

Now use array of voltage numbers instead. Clean code with simpler way.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-05-25 10:16:02 +01:00
Haojian Zhuang 192bbb95ca regulator: make 88pm860x sharing one driver structure
Remove a lot of driver structures in 88pm860x driver. Make regulators share
one driver structure.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-05-25 10:16:02 +01:00
Haojian Zhuang 34a4b2391e regulator: Unsupport 88pm8607 A0 and A1
Remove the support 88PM8607 A0/A1 stepping. There's some register
definition changes in B0 stepping. It can make software more efficient.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-03-07 22:17:06 +01:00
Haojian Zhuang 53dbab7af9 mfd: Support 88pm8606 in 860x driver
88PM8606 and 88PM8607 are two discrete chips used for power management.
Hardware designer can use them together or only one of them according to
requirement.

There's some logic tightly linked between these two chips. For example, USB
charger driver needs to access both chips by I2C interface.

Now share one driver to these two devices. Only one I2C client is identified
in platform init data. If another chip is also used, user should mark it in
companion_addr field of platform init data. Then driver could create another
I2C client for the companion chip.

All I2C operations are accessed by 860x-i2c driver. In order to support both
I2C client address, the read/write API is changed in below.

reg_read(client, offset)
reg_write(client, offset, data)

The benefit is that client drivers only need one kind of read/write API. I2C
and MFD driver can be shared in both 8606 and 8607.

Since API is changed, update API in 8607 regulator driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-03-07 22:17:01 +01:00
Mark Brown ddec68107a regulator: Ensure val is initialised in 88pm8607 choose_voltage()
If we fall through it means that we hit an unknown regulator/chip
combination so set -ENOENT as an explicit flag (the return code
is only used internally).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-17 10:27:25 +00:00
Haojian Zhuang be0e2d3e80 regulator: add 88PM8607 PMIC driver
Hi Liam,

Since Samuel merged a new version of mfd 88pm8607 driver, I format a
new patch on regulator 88pm8607. I paste the new patch in mail. Please
help to review again. And I also attach the mfd driver in mail.

From: Haojian Zhuang <haojian.zhuang@marvell.com>
Date: Thu, 8 Oct 2009 09:36:53 -0400
Subject: [PATCH] regulator: Add 88PM8607 PMIC driver

This patch adds regulator drivers for Marvell 88PM8607 PMIC.
This controller contains 3 DVC and 14 LDO regulators. This controller
uses I2C interface.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-17 10:27:23 +00:00