profile/ivi/kernel-x86-ivi.git
12 years agoregulator: arizona: Add support for microphone supplies on Arizona devices
Mark Brown [Thu, 14 Jun 2012 17:14:00 +0000 (18:14 +0100)]
regulator: arizona: Add support for microphone supplies on Arizona devices

The Wolfson Arizona platform is used for a range of low power audio hub
CODECs. Many of these devices feature an integrated power supply for the
microphone which is supported by this driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: lp872x: Return -EINVAL if pdata is NULL
Axel Lin [Wed, 20 Jun 2012 08:13:15 +0000 (16:13 +0800)]
regulator: lp872x: Return -EINVAL if pdata is NULL

Return -EINVAL if pdata is NULL, otherwise we have NULL dereference bug.
This patch also moves the code checking pdata earlier in lp872x_probe.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Implement .set_ramp_delay() callback
Yadwinder Singh Brar [Wed, 20 Jun 2012 05:20:51 +0000 (10:50 +0530)]
regulator: max77686: Implement .set_ramp_delay() callback

This patch implements the .set_ramp_delay callback to set the ramp_delay on
hardware for BUCK2/3/4 if ramp_delay is set in regulator constraints.

This patch also do some cleaning work for unrequired members of
struct max77686_data.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Initialize regulator_config
Axel Lin [Wed, 20 Jun 2012 07:01:25 +0000 (15:01 +0800)]
regulator: max77686: Initialize regulator_config

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: lp872x: Don't allow modular build
Mark Brown [Wed, 20 Jun 2012 10:08:43 +0000 (11:08 +0100)]
regulator: lp872x: Don't allow modular build

Fixes link failure due to devm_gpio_request_one()

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: add new regulator driver for lp872x
Kim, Milo [Tue, 19 Jun 2012 07:08:22 +0000 (07:08 +0000)]
regulator: add new regulator driver for lp872x

This driver supports TI/National LP8720, LP8725 PMIC.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Reviewed-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65023: Convert tps65023_ldo_ops to regulator_[get|set]_voltage_sel_regmap
Axel Lin [Tue, 19 Jun 2012 09:14:31 +0000 (17:14 +0800)]
regulator: tps65023: Convert tps65023_ldo_ops to regulator_[get|set]_voltage_sel_regmap

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: s5m8767a: Support AP watchdog reset operation
Sangbeom Kim [Mon, 18 Jun 2012 00:49:20 +0000 (09:49 +0900)]
regulator: s5m8767a: Support AP watchdog reset operation

The S5M8767A can't know status of ap reset.
So, After AP watchdog reset, AP can't boot normally.

Problem can be happened like below condition.
- AP Bootable lowest voltage(vdd_arm): 0.9v
- AP DVFS voltage table: 0.8v, 0.9v, 1.0v
- During AP works on lowest voltage(0.8V), watchdog reset is asserted
- AP can't boot, because vdd arm is still 0.8v

Solution
- Basic concept:
  After ap watchdog reset, GPIO configuration is changed by default value
- S5M8767A has function of voltage control with gpio (8 levels with 3 gpios)
- Set bootable voltage on level 0 -> can work with default gpio configuration
- In the probing, Change voltage control level from level 0 to level 1
- Execute normal dvfs operation on level 1
- After watchdog reset, ap gpio is set by default value
- PMIC operation mode is changed by ap reset (level1 -> level0)
- Regardless of previous vdd_arm voltage, AP always can be booted.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Convert driver to use regulator_set_voltage_time_sel.
Yadwinder Singh Brar [Tue, 19 Jun 2012 07:53:42 +0000 (13:23 +0530)]
regulator: max77686: Convert driver to use regulator_set_voltage_time_sel.

This patch converts the driver to use regulator_set_voltage_time_sel() as
.set_voltage_time_sel() callback. It also sets ramp_delay as 100000 uV/us for
LDOs & normal BUCKs and 27500 uV/us(default/reset value) for BUCKs[2/3/4] in
regulator_desc[].

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65023: Convert to get_voltage_sel
Axel Lin [Tue, 19 Jun 2012 09:13:13 +0000 (17:13 +0800)]
regulator: tps65023: Convert to get_voltage_sel

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65023: Convert to regulator_list_voltage_table
Axel Lin [Tue, 19 Jun 2012 09:12:18 +0000 (17:12 +0800)]
regulator: tps65023: Convert to regulator_list_voltage_table

In current mapping table settings, min_uV/max_uV are always
equal to volt_table[0] and volt_table[table_len -1].
Thus remove min_uV and max_uV from struct tps_info.

The table based mapping with table_len == 1 means fixed voltage.
So we don't need fixed flag to differentiate if it is fixed or not.

This patch adds DCDC_FIXED_3300000_VSEL_table and DCDC_FIXED_1800000_VSEL_table
for fixed voltage cases. So we can convert tps65023_dcdc_ops to
regulator_list_voltage_table. This makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: mc13xxx: Remove mc13xxx_sw_regulator_is_enabled function
Axel Lin [Tue, 19 Jun 2012 06:19:57 +0000 (14:19 +0800)]
regulator: mc13xxx: Remove mc13xxx_sw_regulator_is_enabled function

If .is_enabled callback is not implemented, regulator core assumes that the
regulator is always on. Thus we don't need mc13xxx_sw_regulator_is_enabled
function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: twl: Remove references to 32kHz clock from DT bindings
Mark Brown [Mon, 4 Jun 2012 16:23:13 +0000 (17:23 +0100)]
regulator: twl: Remove references to 32kHz clock from DT bindings

Due to the lack of a generic clock API we'd had the 32kHz clock in the
regulator driver but this is definitely a Linux-specific thing and now
we have a clock API hopefully the code can be moved elsewhere. Try to
avoid getting DTs deployed relying on the 32kHz clock by removing it
from the bindings, grep seems to tell me it's not currently used anyway.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65910: Don't use 0 as NULL
Mark Brown [Fri, 15 Jun 2012 18:04:33 +0000 (19:04 +0100)]
regulator: tps65910: Don't use 0 as NULL

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Change the unit of ramp_delay from mV/uS to uV/uS
Axel Lin [Mon, 18 Jun 2012 06:03:16 +0000 (14:03 +0800)]
regulator: core: Change the unit of ramp_delay from mV/uS to uV/uS

This change makes it possible to set ramp_delay with 0.xxx mV/uS without
truncation issue.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Support table based mapping in regulator_set_voltage_time_sel
Axel Lin [Mon, 18 Jun 2012 02:11:28 +0000 (10:11 +0800)]
regulator: core: Support table based mapping in regulator_set_voltage_time_sel

For table based mapping, we can calculate voltage difference by below equation:
abs(rdev->desc->volt_table[new_selector] - rdev->desc->volt_table[old_selector])

Thus we can make regulator_set_voltage_time_sel work for table based mapping.

regulator_set_voltage_time_sel() only supports linear or table based mapping.
In case it is misused, also warn if neither linear nor table based mapping
is used with regulator_set_voltage_time_sel().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Fix setting constraints->ramp_delay in of_get_regulation_constraints
Axel Lin [Mon, 18 Jun 2012 05:59:02 +0000 (13:59 +0800)]
regulator: Fix setting constraints->ramp_delay in of_get_regulation_constraints

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Add ramp_delay configuration to constraints
Yadwinder Singh Brar [Mon, 11 Jun 2012 12:11:08 +0000 (17:41 +0530)]
regulator: Add ramp_delay configuration to constraints

For some hardwares ramp_delay for BUCKs is a configurable parameter which can
be configured through DT or board file.This patch adds ramp_delay to regulator
constraints and allow user to configure it for regulators which supports this
feature, through DT or board file. It will provide two ways of setting the
ramp_delay for a regulator:
First, by setting it as constraints in board file(for configurable
regulators) and set_machine_constraints() will take care of setting it on
hardware by calling(the provided) .set_ramp_delay() operation(callback).
Second, by setting it as data in regulator_desc(as fixed/default
ramp_delay rate) for a regulator in driver.

regulator_set_voltage_time_sel() will give preference to
constraints->ramp_delay while reading ramp_delay rate for regulator. Similarly
users should also take care accordingly while refering ramp_delay rate(in case
of implementing their private .set_voltage_time_sel() callbacks for different
regulators).

[Rewrote subject for 80 columns -- broonie]

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage
Axel Lin [Wed, 13 Jun 2012 12:29:17 +0000 (20:29 +0800)]
regulator: wm831x-dcdc: Convert wm831x_buckv_ops to set_voltage_sel and map_voltage

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap
Axel Lin [Wed, 13 Jun 2012 12:27:58 +0000 (20:27 +0800)]
regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_set_voltage_sel_regmap

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm831x-ldo: Convert to regulator_set_voltage_sel_regmap and map_voltage
Axel Lin [Tue, 12 Jun 2012 02:46:43 +0000 (10:46 +0800)]
regulator: wm831x-ldo: Convert to regulator_set_voltage_sel_regmap and map_voltage

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab3100: Convert fixed voltage to use regulator_list_voltage_linear
Axel Lin [Mon, 11 Jun 2012 02:14:28 +0000 (10:14 +0800)]
regulator: ab3100: Convert fixed voltage to use regulator_list_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: pcf50633: Convert to regulator_set_voltage_sel_regmap and map_voltage
Axel Lin [Mon, 11 Jun 2012 06:43:57 +0000 (14:43 +0800)]
regulator: pcf50633: Convert to regulator_set_voltage_sel_regmap and map_voltage

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info
Axel Lin [Fri, 8 Jun 2012 02:29:21 +0000 (10:29 +0800)]
regulator: ab8500: Remove min_uV and max_uV from struct ab8500_regulator_info

The min_uV and max_uV are not really used in the code and misleading because
the min_uV and max_uV settings does not match the value in the voltage table.

For example, we have
static const unsigned int ldo_vaux3_voltages[] = {
        1200000,
        1500000,
        1800000,
        2100000,
        2500000,
        2750000,
        2790000,
        2910000,
};

With below min_uV/max_uV settings for AB8500_LDO_AUX3.
.min_uV                 = 1100000,
.max_uV                 = 3300000,

The min_uV/max_uV for AB8500_LDO_AUX3 seems copy-paste from AB8500_LDO_AUX2
and is wrong.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops
Axel Lin [Fri, 8 Jun 2012 02:27:49 +0000 (10:27 +0800)]
regulator: ab8500: Use regulator_list_voltage_linear for ab8500_regulator_fixed_ops

Also removes set_voltage_time_sel callback from ab8500_regulator_fixed_ops
because the voltage won't change. ( And ab8500_regulator_fixed_ops does not
implement get_voltage_sel so set_voltage_time_sel won't be called )

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: mc13xxx: Convert to regulator_list_voltage_table
Axel Lin [Fri, 8 Jun 2012 07:41:48 +0000 (15:41 +0800)]
regulator: mc13xxx: Convert to regulator_list_voltage_table

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: mc13xxx: Fix voltage checking for mc13xxx_fixed_regulator_set_voltage
Axel Lin [Fri, 8 Jun 2012 07:39:34 +0000 (15:39 +0800)]
regulator: mc13xxx: Fix voltage checking for mc13xxx_fixed_regulator_set_voltage

The voltage range checking should be to ensure mc13xxx_regulators[id].voltages[0]
falls with min_uV and max_uV.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation
Axel Lin [Fri, 8 Jun 2012 06:35:32 +0000 (14:35 +0800)]
regulator: tps62360: Simplify tps62360_set_voltage_time_sel implementation

For linear mappings, we can use below equation to get the voltage difference
between new_selector and old_selector:

abs(new_selector - old_selector) * rdev->desc->uV_step

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear
Axel Lin [Wed, 13 Jun 2012 12:27:14 +0000 (20:27 +0800)]
regulator: wm831x-dcdc: Convert wm831x_buckp_ops to regulator_list_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65023: Set n_voltages to 1 for fixed voltage
Axel Lin [Thu, 14 Jun 2012 02:22:59 +0000 (10:22 +0800)]
regulator: tps65023: Set n_voltages to 1 for fixed voltage

For fixed voltage, the n_voltages should be 1 rather than 0.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Reuse map_voltage() to get selector of a given uV
Axel Lin [Tue, 12 Jun 2012 12:10:26 +0000 (20:10 +0800)]
regulator: wm8350: Reuse map_voltage() to get selector of a given uV

Reuse map_voltage() to get the selector of a given uV.

Then we can remove wm8350_ldo_mvolts_to_val() and wm8350_dcdc_mvolts_to_val().
Also remove unused wm8350_dcdc_val_to_mvolts() function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Use wm8350_ldo_list_voltage instead of open code to verify selecte...
Axel Lin [Tue, 12 Jun 2012 12:08:30 +0000 (20:08 +0800)]
regulator: wm8350: Use wm8350_ldo_list_voltage instead of open code to verify selected voltage

Call wm8350_ldo_list_voltage() instead of open code to verify selected voltage
falls within specified range.
Use wm8350_ldo_list_voltage() here is less error prone.

wm8350_ldo_val_to_mvolts() is only used in wm8350_ldo_list_voltage now, so
remove it and move the implementation to wm8350_ldo_list_voltage().

This patch also include below small changes in wm8350_ldo_map_voltage:
1. wm8350_ldo_map_voltage() returns selector, thus rename variable mV to sel.
2. Use DIV_ROUND_UP macro to calculate selector.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps65217: Convert to regulator_[is_enabled|get_voltage_sel]_regmap
Axel Lin [Wed, 13 Jun 2012 03:27:11 +0000 (11:27 +0800)]
regulator: tps65217: Convert to regulator_[is_enabled|get_voltage_sel]_regmap

This patch converts .is_enabled and .get_voltage_sel to
regulator_is_enabled_regmap and regulator_get_voltage_sel_regmap.

For .enable, .disable, and .set_voltage_sel, the write protect level is either
1 or 2. So we cannot use regulator_[enable|disable|set_voltage_sel]_regmap.

Now we store the enable reg/mask and vsel reg/mask in regulator_desc,
so we can remove enable_mask, set_vout_reg, and set_vout_mask from
struct tps_info.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8400: Adjust the equation for selector >= 15 in wm8400_ldo_list_voltage
Axel Lin [Tue, 12 Jun 2012 08:36:20 +0000 (16:36 +0800)]
regulator: wm8400: Adjust the equation for selector >= 15 in wm8400_ldo_list_voltage

Adjust the equation for selector >= 15 for better readability.
The equation "1700000 + ((selector - 15) * 100000)" can be interpreted by:
Starting from selector 15: Steps of 100mV from 1700mV

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Replace set_voltage with set_voltage_sel
Sangbeom Kim [Wed, 13 Jun 2012 08:28:18 +0000 (17:28 +0900)]
regulator: Replace set_voltage with set_voltage_sel

To apply delay time for voltage change,
replace s5m8767_set_voltage with s5m8767_set_voltage_sel.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8400: Use wm8400_ldo_list_voltage instead of open code to verify selecte...
Axel Lin [Tue, 12 Jun 2012 08:34:55 +0000 (16:34 +0800)]
regulator: wm8400: Use wm8400_ldo_list_voltage instead of open code to verify selected voltage

Call wm8400_ldo_list_voltage() instead of open code to verify selected voltage
falls within specified range.
Use wm8400_ldo_list_voltage() here is less error prone.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Remove s5m8767a buck initialization
Sangbeom Kim [Wed, 13 Jun 2012 08:26:15 +0000 (17:26 +0900)]
regulator: Remove s5m8767a buck initialization

As s5m8767a is revisioned, remove unnecessary buck 2,3,4 initialization routine.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Add missing min_uV and uV_step settings for DCDC4
Axel Lin [Tue, 12 Jun 2012 09:18:49 +0000 (17:18 +0800)]
regulator: wm8350: Add missing min_uV and uV_step settings for DCDC4

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Return correct delay time in regulator_set_voltage_time_sel
Axel Lin [Mon, 11 Jun 2012 05:14:50 +0000 (13:14 +0800)]
regulator: core: Return correct delay time in regulator_set_voltage_time_sel

rdev->desc->uV_step * abs(new_selector - old_selector) returns uV.
The unit of ramp_delay is mV/us.

Current code multiples 1000 at wrong place.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Fix the delay time for set_voltage_time_sel
Axel Lin [Fri, 8 Jun 2012 09:21:44 +0000 (17:21 +0800)]
regulator: max77686: Fix the delay time for set_voltage_time_sel

rdev->desc->uV_step * abs(new_selector - old_selector) returns uV.
The unit of ramp_rate is mV/us.
Thus 1000 should be multiplied.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Add regulator_set_voltage_time_sel to calculate ramp delay.
Yadwinder Singh Brar [Sat, 9 Jun 2012 11:10:38 +0000 (16:40 +0530)]
regulator: core: Add regulator_set_voltage_time_sel to calculate ramp delay.

This patch adds regulator_set_voltage_time_sel(), to move into core, the
commonly used code by drivers to provide the .set_voltage_time_sel callback.
It will also allow us to configure different ramp delay for different
regulators easily.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Check pdata->num_regulators earlier
Axel Lin [Fri, 8 Jun 2012 04:03:04 +0000 (12:03 +0800)]
regulator: max77686: Check pdata->num_regulators earlier

If this driver only works when pdata->num_regulators == MAX77686_REGULATORS,
let's check it earlier.

Also remove unused num_regulators from struct max77686_data.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: anatop: Convert to set_voltage_sel and regulator_map_voltage_linear
Axel Lin [Sun, 3 Jun 2012 15:02:34 +0000 (23:02 +0800)]
regulator: anatop: Convert to set_voltage_sel and regulator_map_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: twl: Convert twl6030ldo_ops to use regulator_list_voltage_linear
Axel Lin [Mon, 4 Jun 2012 04:44:15 +0000 (12:44 +0800)]
regulator: twl: Convert twl6030ldo_ops to use regulator_list_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: isl6271a: Remove setting map_voltage callback for isl_fixed_ops
Axel Lin [Fri, 8 Jun 2012 02:04:42 +0000 (10:04 +0800)]
regulator: isl6271a: Remove setting map_voltage callback for isl_fixed_ops

isl_fixed_ops does not implement set_voltage_sel callback, adding map_voltage
here is misleading.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max1586: Convert max1586_v3_ops to set_voltage_sel and map_voltage_linear
Axel Lin [Fri, 8 Jun 2012 00:26:44 +0000 (08:26 +0800)]
regulator: max1586: Convert max1586_v3_ops to set_voltage_sel and map_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max1586: Convert max1586_v3_ops to regulator_list_voltage_linear
Axel Lin [Fri, 8 Jun 2012 00:25:41 +0000 (08:25 +0800)]
regulator: max1586: Convert max1586_v3_ops to regulator_list_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps6586x: Convert to regulator_list_voltage_table
Axel Lin [Tue, 5 Jun 2012 14:52:06 +0000 (22:52 +0800)]
regulator: tps6586x: Convert to regulator_list_voltage_table

Also adds tps6586x_ldo0_voltages mapping table for LDO0, so we can remove the
hack in tps6586x_list_voltage() and convert it to regulator_list_voltage_table.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: pcap: Convert to regulator_list_voltage_table
Axel Lin [Wed, 6 Jun 2012 00:36:37 +0000 (08:36 +0800)]
regulator: pcap: Convert to regulator_list_voltage_table

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: palmas: Slightly code change for better readability
Axel Lin [Wed, 6 Jun 2012 12:01:38 +0000 (20:01 +0800)]
regulator: palmas: Slightly code change for better readability

It's a little bit hard to read that the "else" case means id == PALMAS_REG_SMPS10.

if (id != PALMAS_REG_SMPS10){
        do something for the cases id != PALMAS_REG_SMPS10;
} else {
        do something for the case id == PALMAS_REG_SMPS10;
}

This patch changes above syntax to switch statement.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: palmas: Clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits in palmas_set_mode_smps
Axel Lin [Thu, 7 Jun 2012 09:08:21 +0000 (17:08 +0800)]
regulator: palmas: Clear PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits in palmas_set_mode_smps

Current code actually clears more bits than PALMAS_SMPS12_CTRL_MODE_ACTIVE_MASK bits.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: rc5t583: Simplify rc5t583_set_voltage_time_sel implementation
Axel Lin [Thu, 7 Jun 2012 08:38:09 +0000 (16:38 +0800)]
regulator: rc5t583: Simplify rc5t583_set_voltage_time_sel implementation

For linear mappings, we can use below equation to get the voltage difference
between new_selector and old_selector:

abs(new_selector - old_selector) * rdev->desc->uV_step

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address
Axel Lin [Thu, 7 Jun 2012 02:38:30 +0000 (10:38 +0800)]
regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address

For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is
DA9030_INVAL/DA9034_INVAL.
It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: isl6271a: Use regulator_[list|map]_voltage_linear for isl_fixed_ops
Axel Lin [Thu, 7 Jun 2012 02:06:40 +0000 (10:06 +0800)]
regulator: isl6271a: Use regulator_[list|map]_voltage_linear for isl_fixed_ops

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Handle fixed voltage in map_voltage_linear
Axel Lin [Thu, 7 Jun 2012 02:05:14 +0000 (10:05 +0800)]
regulator: core: Handle fixed voltage in map_voltage_linear

Fixed voltage is a kind of linear mapping where n_voltages is 1.
This change allows [list|map]_voltage_linear to be used for fixed
voltage.

For fixed voltage, n_voltages is 1 and the only valid selector is 0.
Thus we actually don't care the uV_step setting.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps6507x: Avoid duplicating the same mapping table for LDO2 and VDCDCx
Axel Lin [Tue, 5 Jun 2012 00:58:13 +0000 (08:58 +0800)]
regulator: tps6507x: Avoid duplicating the same mapping table for LDO2 and VDCDCx

The voltage mapping table for LDO2 is exactly the same as VDCDCx.
Thus we can use one mapping table for both LDO2 and VDCDCx instead of
duplicating the mapping table.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps6507x: Remove unused min_uV and max_uV from struct tps_info
Axel Lin [Tue, 5 Jun 2012 00:39:52 +0000 (08:39 +0800)]
regulator: tps6507x: Remove unused min_uV and max_uV from struct tps_info

The min_uV and max_uV are not used in this driver.
For table based voltage mappings, we can get min_uV and max_uV by
info->table[0] and info->table[table_len -1].
Thus remove min_uV and max_uV from struct tps_info.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Fix checkpatch warnings
Axel Lin [Mon, 4 Jun 2012 02:19:18 +0000 (10:19 +0800)]
regulator: max77686: Fix checkpatch warnings

Fix below checkpatch warnings:

$ scripts/checkpatch.pl -f drivers/regulator/max77686.c
ERROR: return is not a function, parentheses are not required
+       return (DIV_ROUND_UP(rdev->desc->uV_step

WARNING: line over 80 characters
+       .ops            = &max77686_buck_dvs_ops,                               \

total: 1 errors, 1 warnings, 339 lines checked

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max1586: Convert max1586_v6_ops to set_voltage_sel
Axel Lin [Mon, 4 Jun 2012 04:58:24 +0000 (12:58 +0800)]
regulator: max1586: Convert max1586_v6_ops to set_voltage_sel

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max1586: Convert max1586_v6_ops to regulator_list_voltage_table
Axel Lin [Mon, 4 Jun 2012 04:56:58 +0000 (12:56 +0800)]
regulator: max1586: Convert max1586_v6_ops to regulator_list_voltage_table

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Convert LDOs to set_voltage_sel()
Mark Brown [Wed, 9 May 2012 21:27:41 +0000 (22:27 +0100)]
regulator: wm8350: Convert LDOs to set_voltage_sel()

Since there are two linear ranges for the LDO voltages provide a voltage
mapping function and then use regulator_set_voltage_sel_regmap().

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: max77686: Use regulator_map_voltage_linear for simple linear mappings
Axel Lin [Sun, 3 Jun 2012 14:46:14 +0000 (22:46 +0800)]
regulator: max77686: Use regulator_map_voltage_linear for simple linear mappings

Both max77686_ops and max77686_buck_dvs_ops use simple linear voltage maps.
Thus use regulator_map_voltage_linear is more efficient than using the defult
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Use regulator_map_voltage_linear for wm8350_dcdc_ops
Axel Lin [Sun, 3 Jun 2012 15:12:16 +0000 (23:12 +0800)]
regulator: wm8350: Use regulator_map_voltage_linear for wm8350_dcdc_ops

wm8350_dcdc_ops uses simple linear voltage maps.
Thus use regulator_map_voltage_linear is more efficient than using the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Change db8500-prcmu match names to reflect Device Tree
Lee Jones [Wed, 30 May 2012 04:47:27 +0000 (12:47 +0800)]
regulator: Change db8500-prcmu match names to reflect Device Tree

The 'name' field in 'struct of_regulator_match' expects to match with
its corresponding regulator device node in the Device Tree. This patch
renames each of the regulators in the db8500-prcum regulator driver so
this is true.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: Change ab8500 match names to reflect Device Tree
Lee Jones [Wed, 30 May 2012 04:47:26 +0000 (12:47 +0800)]
regulator: Change ab8500 match names to reflect Device Tree

The 'name' field in 'struct of_regulator_match' expects to match with
its corresponding regulator device node in the Device Tree. This patch
renames each of the regulators in the ab8500 regulator driver so this
is true.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: fixed: Use of_match_ptr() for of_match_table entry
Axel Lin [Fri, 1 Jun 2012 04:16:25 +0000 (12:16 +0800)]
regulator: fixed: Use of_match_ptr() for of_match_table entry

Use the new of_match_ptr() macro for the of_match_table
pointer entry to avoid having to #define match NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: MAX77686: Add Maxim 77686 regulator driver
Jonghwa Lee [Fri, 1 Jun 2012 04:17:14 +0000 (13:17 +0900)]
regulator: MAX77686: Add Maxim 77686 regulator driver

Add driver for support max77686 regulator.
MAX77686 provides LDOs[1~26] and BUCKs[1~9]. It support to set or get the
volatege of regulator on max77686 chip with using regmap.

Signed-off-by: Chiwoong Byun <woong.byun@samsung.com>
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8400: Use regulator_map_voltage_linear for wm8400_dcdc_ops
Axel Lin [Thu, 31 May 2012 09:40:22 +0000 (17:40 +0800)]
regulator: wm8400: Use regulator_map_voltage_linear for wm8400_dcdc_ops

wm8400_dcdc_ops uses simple linear voltage maps.
Thus use regulator_map_voltage_linear is more efficient than using the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm831x-ldo: Use regulator_map_voltage_linear for wm831x_alive_ldo_ops
Axel Lin [Thu, 31 May 2012 09:39:00 +0000 (17:39 +0800)]
regulator: wm831x-ldo: Use regulator_map_voltage_linear for wm831x_alive_ldo_ops

wm831x_alive_ldo_ops uses simple linear voltage maps.
Thus use regulator_map_voltage_linear is more efficient than using the default
regulator_map_voltage_iterate.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8994: Convert wm8994_ldo1_ops to regulator_[list|map]_voltage_linear
Axel Lin [Wed, 23 May 2012 14:40:58 +0000 (22:40 +0800)]
regulator: wm8994: Convert wm8994_ldo1_ops to regulator_[list|map]_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: anatop: Convert to regulator_list_voltage_linear()
Axel Lin [Mon, 14 May 2012 03:06:44 +0000 (11:06 +0800)]
regulator: anatop: Convert to regulator_list_voltage_linear()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: palmas: Use regulator_[list|map]_voltage_linear() for palmas_ops_smps10
Axel Lin [Tue, 22 May 2012 04:26:42 +0000 (12:26 +0800)]
regulator: palmas: Use regulator_[list|map]_voltage_linear() for palmas_ops_smps10

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Convert DCDCs to set_voltage_sel() and linear voltages
Mark Brown [Wed, 9 May 2012 21:22:30 +0000 (22:22 +0100)]
regulator: wm8350: Convert DCDCs to set_voltage_sel() and linear voltages

The WM8350 DCDCs have a simple linear mapping from selectors to voltages
so can be converted very simply to use the new infrastructure for a nice
reduction in code size.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Convert to core regmap-based enable operations
Mark Brown [Mon, 30 Apr 2012 20:08:59 +0000 (21:08 +0100)]
regulator: wm8350: Convert to core regmap-based enable operations

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: wm8350: Convert to use core regmap vsel readback
Mark Brown [Mon, 30 Apr 2012 20:00:10 +0000 (21:00 +0100)]
regulator: wm8350: Convert to use core regmap vsel readback

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab8500: Let regulator core handle the case no delay for setting new voltag...
Axel Lin [Mon, 21 May 2012 01:39:08 +0000 (09:39 +0800)]
regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: lp3971: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 05:30:28 +0000 (13:30 +0800)]
regulator: lp3971: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps6507x: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 02:39:12 +0000 (10:39 +0800)]
regulator: tps6507x: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: tps6105x: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 02:37:33 +0000 (10:37 +0800)]
regulator: tps6105x: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: lp3972: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 02:36:17 +0000 (10:36 +0800)]
regulator: lp3972: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab8500: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 02:33:35 +0000 (10:33 +0800)]
regulator: ab8500: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: ab3100: Use regulator_list_voltage_table()
Axel Lin [Sun, 20 May 2012 02:31:58 +0000 (10:31 +0800)]
regulator: ab3100: Use regulator_list_voltage_table()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Use dev_get_regmap() to find the regmap
Mark Brown [Tue, 8 May 2012 17:10:45 +0000 (18:10 +0100)]
regulator: core: Use dev_get_regmap() to find the regmap

If no regmap is explicitly specified then use dev_get_regmap() to obtain
one. The driver must explicitly enable any actual usage of the regmap
so there's no concern with unwanted usage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
12 years agoregulator: Use newly added devres_release() rather than open coding
Mark Brown [Mon, 7 May 2012 13:14:30 +0000 (14:14 +0100)]
regulator: Use newly added devres_release() rather than open coding

devres_release() will call the destructor for the resource as well as
freeing the devres data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
12 years agoregulator: core: Call set_voltage_time_sel() only when the regulator is on
Axel Lin [Mon, 21 May 2012 01:37:52 +0000 (09:37 +0800)]
regulator: core: Call set_voltage_time_sel() only when the regulator is on

If the regulator is not on, it won't take time setting new voltage.
So only call set_voltage_time_sel() to get the necessary delay when
the regulator is on.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoregulator: core: Allow drivers to set voltage mapping table in regulator_desc
Axel Lin [Sun, 20 May 2012 02:30:21 +0000 (10:30 +0800)]
regulator: core: Allow drivers to set voltage mapping table in regulator_desc

Some regulator hardware use table based mapping can set volt_table in
regulator_desc and use regulator_list_voltage_table() for their list_voltage
callback.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
12 years agoLinux 3.5-rc1 v3.5-rc1
Linus Torvalds [Sun, 3 Jun 2012 01:29:26 +0000 (18:29 -0700)]
Linux 3.5-rc1

12 years agoMerge tag 'dm-3.5-changes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/agk...
Linus Torvalds [Sun, 3 Jun 2012 00:39:40 +0000 (17:39 -0700)]
Merge tag 'dm-3.5-changes-1' of git://git./linux/kernel/git/agk/linux-dm

Pull device-mapper updates from Alasdair G Kergon:
 "Improve multipath's retrying mechanism in some defined circumstances
  and provide a simple reserve/release mechanism for userspace tools to
  access thin provisioning metadata while the pool is in use."

* tag 'dm-3.5-changes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm:
  dm thin: provide userspace access to pool metadata
  dm thin: use slab mempools
  dm mpath: allow ioctls to trigger pg init
  dm mpath: delay retry of bypassed pg
  dm mpath: reduce size of struct multipath

12 years agodm thin: provide userspace access to pool metadata
Joe Thornber [Sat, 2 Jun 2012 23:30:01 +0000 (00:30 +0100)]
dm thin: provide userspace access to pool metadata

This patch implements two new messages that can be sent to the thin
pool target allowing it to take a snapshot of the _metadata_.  This,
read-only snapshot can be accessed by userland, concurrently with the
live target.

Only one metadata snapshot can be held at a time.  The pool's status
line will give the block location for the current msnap.

Since version 0.1.5 of the userland thin provisioning tools, the
thin_dump program displays the msnap as follows:

    thin_dump -m <msnap root> <metadata dev>

Available here: https://github.com/jthornber/thin-provisioning-tools

Now that userland can access the metadata we can do various things
that have traditionally been kernel side tasks:

     i) Incremental backups.

     By using metadata snapshots we can work out what blocks have
     changed over time.  Combined with data snapshots we can ensure
     the data doesn't change while we back it up.

     A short proof of concept script can be found here:

     https://github.com/jthornber/thinp-test-suite/blob/master/incremental_backup_example.rb

     ii) Migration of thin devices from one pool to another.

     iii) Merging snapshots back into an external origin.

     iv) Asyncronous replication.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agodm thin: use slab mempools
Mike Snitzer [Sat, 2 Jun 2012 23:30:00 +0000 (00:30 +0100)]
dm thin: use slab mempools

Use dedicated caches prefixed with a "dm_" name rather than relying on
kmalloc mempools backed by generic slab caches so the memory usage of
thin provisioning (and any leaks) can be accounted for independently.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agodm mpath: allow ioctls to trigger pg init
Mikulas Patocka [Sat, 2 Jun 2012 23:29:58 +0000 (00:29 +0100)]
dm mpath: allow ioctls to trigger pg init

After the failure of a group of paths, any alternative paths that
need initialising do not become available until further I/O is sent to
the device.  Until this has happened, ioctls return -EAGAIN.

With this patch, new paths are made available in response to an ioctl
too.  The processing of the ioctl gets delayed until this has happened.

Instead of returning an error, we submit a work item to kmultipathd
(that will potentially activate the new path) and retry in ten
milliseconds.

Note that the patch doesn't retry an ioctl if the ioctl itself fails due
to a path failure.  Such retries should be handled intelligently by the
code that generated the ioctl in the first place, noting that some SCSI
commands should not be retried because they are not idempotent (XOR write
commands).  For commands that could be retried, there is a danger that
if the device rejected the SCSI command, the path could be errorneously
marked as failed, and the request would be retried on another path which
might fail too.  It can be determined if the failure happens on the
device or on the SCSI controller, but there is no guarantee that all
SCSI drivers set these flags correctly.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agodm mpath: delay retry of bypassed pg
Mike Christie [Sat, 2 Jun 2012 23:29:45 +0000 (00:29 +0100)]
dm mpath: delay retry of bypassed pg

If I/O needs retrying and only bypassed priority groups are available,
set the pg_init_delay_retry flag to wait before retrying.

If, for example, the reason for the bypass is that the controller is
getting reset or there is a firmware upgrade happening, retrying right
away would cause a flood of log messages and retries for what could be a
few seconds or even several minutes.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agodm mpath: reduce size of struct multipath
Mike Snitzer [Sat, 2 Jun 2012 23:29:43 +0000 (00:29 +0100)]
dm mpath: reduce size of struct multipath

Move multipath structure's 'lock' and 'queue_size' members to eliminate
two 4-byte holes.  Also use a bit within a single unsigned int for each
existing flag (saves 8-bytes).  This allows future flags to be added
without each consuming an unsigned int.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Acked-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
12 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Sat, 2 Jun 2012 23:22:51 +0000 (16:22 -0700)]
Merge git://git./linux/kernel/git/davem/net

Pull networking updates from David Miller:

 1) Make syn floods consume significantly less resources by

    a) Not pre-COW'ing routing metrics for SYN/ACKs
    b) Mirroring the device queue mapping of the SYN for the SYN/ACK
       reply.

    Both from Eric Dumazet.

 2) Fix calculation errors in Byte Queue Limiting, from Hiroaki SHIMODA.

 3) Validate the length requested when building a paged SKB for a
    socket, so we don't overrun the page vector accidently.  From Jason
    Wang.

 4) When netlabel is disabled, we abort all IP option processing when we
    see a CIPSO option.  This isn't the right thing to do, we should
    simply skip over it and continue processing the remaining options
    (if any).  Fix from Paul Moore.

 5) SRIOV fixes for the mellanox driver from Jack orgenstein and Marcel
    Apfelbaum.

 6) 8139cp enables the receiver before the ring address is properly
    programmed, which potentially lets the device crap over random
    memory.  Fix from Jason Wang.

 7) e1000/e1000e fixes for i217 RST handling, and an improper buffer
    address reference in jumbo RX frame processing from Bruce Allan and
    Sebastian Andrzej Siewior, respectively.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
  fec_mpc52xx: fix timestamp filtering
  mcs7830: Implement link state detection
  e1000e: fix Rapid Start Technology support for i217
  e1000: look into the page instead of skb->data for e1000_tbi_adjust_stats()
  r8169: call netif_napi_del at errpaths and at driver unload
  tcp: reflect SYN queue_mapping into SYNACK packets
  tcp: do not create inetpeer on SYNACK message
  8139cp/8139too: terminate the eeprom access with the right opmode
  8139cp: set ring address before enabling receiver
  cipso: handle CIPSO options correctly when NetLabel is disabled
  net: sock: validate data_len before allocating skb in sock_alloc_send_pskb()
  bql: Avoid possible inconsistent calculation.
  bql: Avoid unneeded limit decrement.
  bql: Fix POSDIFF() to integer overflow aware.
  net/mlx4_core: Fix obscure mlx4_cmd_box parameter in QUERY_DEV_CAP
  net/mlx4_core: Check port out-of-range before using in mlx4_slave_cap
  net/mlx4_core: Fixes for VF / Guest startup flow
  net/mlx4_en: Fix improper use of "port" parameter in mlx4_en_event
  net/mlx4_core: Fix number of EQs used in ICM initialisation
  net/mlx4_core: Fix the slave_id out-of-range test in mlx4_eq_int

12 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 2 Jun 2012 23:17:03 +0000 (16:17 -0700)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull straggler x86 fixes from Peter Anvin:
 "Three groups of patches:

  - EFI boot stub documentation and the ability to print error messages;
  - Removal for PTRACE_ARCH_PRCTL for x32 (obsolete interface which
    should never have been ported, and the port is broken and
    potentially dangerous.)
  - ftrace stack corruption fixes.  I'm not super-happy about the
    technical implementation, but it is probably the least invasive in
    the short term.  In the future I would like a single method for
    nesting the debug stack, however."

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, x32, ptrace: Remove PTRACE_ARCH_PRCTL for x32
  x86, efi: Add EFI boot stub documentation
  x86, efi; Add EFI boot stub console support
  x86, efi: Only close open files in error path
  ftrace/x86: Do not change stacks in DEBUG when calling lockdep
  x86: Allow nesting of the debug stack IDT setting
  x86: Reset the debug_stack update counter
  ftrace: Use breakpoint method to update ftrace caller
  ftrace: Synchronize variable setting with breakpoints

12 years agotty: Revert the tty locking series, it needs more work
Linus Torvalds [Sat, 2 Jun 2012 22:21:43 +0000 (15:21 -0700)]
tty: Revert the tty locking series, it needs more work

This reverts the tty layer change to use per-tty locking, because it's
not correct yet, and fixing it will require some more deep surgery.

The main revert is d29f3ef39be4 ("tty_lock: Localise the lock"), but
there are several smaller commits that built upon it, they also get
reverted here. The list of reverted commits is:

  fde86d310886 - tty: add lockdep annotations
  8f6576ad476b - tty: fix ldisc lock inversion trace
  d3ca8b64b97e - pty: Fix lock inversion
  b1d679afd766 - tty: drop the pty lock during hangup
  abcefe5fc357 - tty/amiserial: Add missing argument for tty_unlock()
  fd11b42e3598 - cris: fix missing tty arg in wait_event_interruptible_tty call
  d29f3ef39be4 - tty_lock: Localise the lock

The revert had a trivial conflict in the 68360serial.c staging driver
that got removed in the meantime.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agofec_mpc52xx: fix timestamp filtering
Stephan Gatzka [Sat, 2 Jun 2012 03:04:06 +0000 (03:04 +0000)]
fec_mpc52xx: fix timestamp filtering

skb_defer_rx_timestamp was called with a freshly allocated skb but must
be called with rskb instead.

Signed-off-by: Stephan Gatzka <stephan@gatzka.org>
Cc: stable <stable@vger.kernel.org>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agomcs7830: Implement link state detection
Ondrej Zary [Fri, 1 Jun 2012 10:29:08 +0000 (10:29 +0000)]
mcs7830: Implement link state detection

Add .status callback that detects link state changes.
Tested with MCS7832CV-AA chip (9710:7830, identified as rev.C by the driver).
Fixes https://bugzilla.kernel.org/show_bug.cgi?id=28532

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 years agoMerge 'for-linus' branches from git://git.kernel.org/pub/scm/linux/kernel/git/viro...
Linus Torvalds [Sat, 2 Jun 2012 16:03:54 +0000 (09:03 -0700)]
Merge 'for-linus' branches from git://git./linux/kernel/git/viro/{vfs,signal}

Pull vfs fix and a fix from the signal changes for frv from Al Viro.

The __kernel_nlink_t for powerpc got scrogged because 64-bit powerpc
actually depended on the default "unsigned long", while 32-bit powerpc
had an explicit override to "unsigned short".  Al didn't notice, and
made both of them be the unsigned short.

The frv signal fix is fallout from simplifying the do_notify_resume()
code, and leaving an extra parenthesis.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  powerpc: Fix size of st_nlink on 64bit

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
  frv: Remove bogus closing parenthesis

12 years agopowerpc: Fix size of st_nlink on 64bit
Anton Blanchard [Sat, 2 Jun 2012 11:34:52 +0000 (21:34 +1000)]
powerpc: Fix size of st_nlink on 64bit

commit e57f93cc53b7 (powerpc: get rid of nlink_t uses, switch to
explicitly-sized type) changed the size of st_nlink on ppc64 from
a long to a short, resulting in boot failures.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>