Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EM-2040 i2c fixes DO NOT MERGE #516

Open
wants to merge 78 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
eebe170
Merge branches 'sunxi/clk-for-4.15', 'sunxi/dt-for-4.15' and 'sunxi/d…
mripard Sep 17, 2017
1718bc7
Merge branch 'sunxi/core-for-4.15' into sunxi/for-next
mripard Sep 22, 2017
3b428b0
Merge branches 'sunxi/dt-for-4.15' and 'sunxi/dt64-for-4.15' into sun…
wens Sep 27, 2017
67bf861
Merge branches 'sunxi/clk-for-4.15' and 'sunxi/dt64-for-4.15' into su…
wens Sep 29, 2017
bba731a
Merge branch 'sunxi/clk-for-4.15' into sunxi/for-next
mripard Oct 6, 2017
42d7dbe
Merge branches 'sunxi/clk-for-4.15' and 'sunxi/dt-for-4.15' into sunx…
wens Oct 11, 2017
be2aeaf
Merge branch 'sunxi/for-next', remote-tracking branch 'drm-misc/drm-m…
wens Oct 11, 2017
2960446
Merge remote-tracking branch 'regulator/topic/axp20x' into sunxi-next
wens Oct 11, 2017
10d1bcf
Merge branches 'sunxi/clk-for-4.15' and 'sunxi/dt-for-4.15' into sunx…
mripard Oct 13, 2017
3be7629
Merge branch 'sunxi/for-next' into sunxi-next
wens Oct 13, 2017
9221d86
Merge remote-tracking branch 'bluetooth-next/master' into sunxi-next
wens Oct 16, 2017
36680a7
Merge branches 'sunxi/clk-for-4.15' and 'sunxi/dt-for-4.15' into sunx…
wens Oct 18, 2017
217a487
Merge branch 'sunxi/for-next' into sunxi-next
wens Oct 18, 2017
8c95670
Merge remote-tracking branch 'drm-misc/drm-misc-next' into sunxi-next
wens Oct 18, 2017
8c05c03
Merge branch 'sunxi/dt-for-4.15' into sunxi/for-next
wens Oct 22, 2017
54c9bca
Merge branch 'sunxi/for-next' into sunxi-next
wens Oct 22, 2017
dad1b42
Merge remote-tracking branch 'slave-dma/topic/sun' into sunxi-next
wens Oct 23, 2017
b599669
Merge branches 'sunxi/dt-for-4.15' and 'sunxi/dt64-for-4.15' into sun…
mripard Nov 2, 2017
9dad3f6
Merge remote-tracking branch 'mfd/for-mfd-next' into sunxi-next
wens Nov 2, 2017
f9a642e
Merge remote-tracking branch 'sunxi-korg/sunxi/for-next' into sunxi-next
wens Nov 2, 2017
c3d8195
Merge remote-tracking branch 'asoc/topic/sunxi' into sunxi-next
wens Nov 9, 2017
c74b34f
fbdev: ssd1306: abort probe if we cannot talk to the display
oliv3r Aug 8, 2017
0bed2fc
fbdev: ssd1307: rename i2c device ids
oliv3r Dec 19, 2017
3b4ca60
fbdev: ssd1306: make output a little more consistent
oliv3r Dec 18, 2017
bc8c3e6
fbdev: ssd1306: use ratelimited error printing
oliv3r Dec 18, 2017
e19c8b8
leds: pca963x: abort probe if device is not connected
oliv3r Aug 8, 2017
683f502
leds: pca963x: alphabetize headers
May 29, 2015
e516b80
leds: pca963x: add defines and remove some magic values
oliv3r Dec 16, 2015
4121ef1
leds: pca963x: save mode when setting power_state
oliv3r Oct 4, 2017
10fd376
leds: pca963x: refactor initial led output a little
oliv3r Oct 4, 2017
1568dc6
leds: pca963x: remove whitespace and checkpatch problems
oliv3r Apr 5, 2016
acf0551
leds: pca963x: set DMBLNK as default during probe
oliv3r Mar 17, 2017
ed038f4
mfd: axp20x: fixup includes
oliv3r Jan 3, 2017
4a4efcf
mfd: axp20x: use explicit bit defines
Oct 4, 2017
03ce04d
power: suppy: axp20x: add missing include bitops.h
oliv3r Jan 3, 2017
dd35aa4
power: suppy: axp288: use the BIT() macro
oliv3r Jan 3, 2017
13b162f
regulator: axp20x: use defines for masks
oliv3r Jan 3, 2017
bb946f3
regulator: axp20x: name voltage ramping define properly
oliv3r Oct 9, 2017
27bef6e
regulator: enable power later when setting up constraints
Mar 6, 2017
c4c4e61
regulator: axp20x: AXP209: add support for set_ramp_delay
oliv3r Mar 2, 2017
aee0eb0
regulator: axp20x: add software based soft_start for LDO3
oliv3r Mar 2, 2017
eedcd47
arm: dts: sunxi: enable soft-start and ramp delay for the OLinuXino L…
oliv3r Mar 3, 2017
2d11ed2
dts: sunxi: Lime2: add full voltage range to LDO4
oliv3r Dec 11, 2017
d2ab365
dts: sunxi: OLinuXino Lime2: set proper lradc vref
oliv3r Dec 18, 2017
aeea6b1
pwm: core: do not block apply->state on period
oliv3r Mar 8, 2017
ed71150
input: of_touchscreen: fix whitespace
oliv3r Dec 11, 2017
de61fc5
input: of_touchscreen: shorten variable names
oliv3r Dec 11, 2017
3d28f05
input: of_touchscreen: rename touchscreen-size-[xy]
oliv3r Dec 11, 2017
fe30204
input: of_touchscreen: add support for minimum sizes
oliv3r Dec 13, 2017
688d6e2
input: edt-ft5x06: add support for the ft5426 controller
oliv3r Dec 13, 2017
0d4e3e7
input: edt-ft5x06: cleanup headers
oliv3r Dec 13, 2017
c957a5d
input: edt-ft5x06: only enable the irq when needed
oliv3r Dec 13, 2017
fb86a27
input: edt-ft5x06: fix some whitespace/ident issues
oliv3r Dec 14, 2017
d862555
input: edt-ft5x06: minor consistency cleanup/line length reduction
oliv3r Dec 14, 2017
5f01050
input: edt-ft5x06: shorten defines
oliv3r Dec 14, 2017
992e1c7
input: edt-ft5x06: use less magic and more defines
oliv3r Dec 15, 2017
046c810
input: edt-ft5x06: silence deferral error
oliv3r Dec 15, 2017
7207bb7
input: edt-ft5x06: sanity check on input
oliv3r Dec 18, 2017
b68c90b
input: edt-ft5x06: fix multi-touch handling
oliv3r Dec 18, 2017
cb474ef
input: edt-ft5x06: take into account the number of fingers
oliv3r Dec 18, 2017
15ecee1
input: edt-ft5x06: add polldev as an option
oliv3r Dec 18, 2017
5777ab1
input: edt-ft5x06: group r, w and rw functions
oliv3r Dec 19, 2017
4f8b339
input: edt-ft5x06: Force touchscreen to remain active
oliv3r Dec 19, 2017
93bf96d
input: ar1021: fix typo in define
oliv3r Oct 19, 2017
35ba713
gpio: pca953x: add support for the NXP pca9570
oliv3r Dec 18, 2017
8872877
ASoC: sun4i-is: also check for NULL on reset pin request
oliv3r Oct 9, 2017
b126923
serial: 8250_dw: minor code cleanup
oliv3r Mar 29, 2017
40d3e78
serial: do not treat the IIR register as a bitfield
oliv3r Mar 29, 2017
6b66bba
serial: tegra: map the iir register to default defines
oliv3r Mar 29, 2017
0365eb6
serial work
oliv3r Apr 21, 2017
7d6eb22
drm/sun4i: i2c: consolidate ddc items
oliv3r Sep 4, 2017
0200fbe
drm: sun4i: fix indenting
oliv3r Oct 10, 2017
80e9170
wip hdmi-i2c, TODO: legacy clocks not working
oliv3r Oct 20, 2017
beb2e13
fix whitespace (kconfig)
oliv3r Feb 6, 2018
6d00bfc
fix hdmi freq divider
oliv3r Feb 6, 2018
795cc47
rtc: sun6i: add missing header
oliv3r Feb 6, 2018
14d6182
of_get_matching_data
oliv3r Feb 6, 2018
ac68ebb
of_reset_control_get_exclusive helper
oliv3r Feb 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 99 additions & 5 deletions drivers/regulator/axp20x-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
.ops = &axp20x_ops_sw,
};

/* DCDC ranges shared with AXP813 */
static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
Expand Down Expand Up @@ -426,6 +427,69 @@ static const struct regulator_desc axp809_regulators[] = {
AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
};

static const struct regulator_desc axp813_regulators[] = {
AXP_DESC(AXP813, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
AXP_DESC_RANGES(AXP813, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(1)),
AXP_DESC_RANGES(AXP813, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(2)),
AXP_DESC_RANGES(AXP813, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(3)),
AXP_DESC_RANGES(AXP813, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(4)),
AXP_DESC_RANGES(AXP813, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(5)),
AXP_DESC_RANGES(AXP813, DCDC7, "dcdc7", "vin7", axp803_dcdc6_ranges,
72, AXP813_DCDC7_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
BIT(6)),
AXP_DESC(AXP813, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
AXP_DESC(AXP813, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
AXP_DESC(AXP813, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
AXP_DESC(AXP813, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
AXP_DESC_RANGES(AXP813, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
BIT(4)),
AXP_DESC(AXP813, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
AXP_DESC(AXP813, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
AXP_DESC(AXP813, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
AXP_DESC(AXP813, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
AXP_DESC(AXP813, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
/* to do / check ... */
AXP_DESC(AXP813, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
AXP_DESC(AXP813, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
/*
* TODO: FLDO3 = {DCDC5, FLDOIN} / 2
*
* This means FLDO3 effectively switches supplies at runtime,
* something the regulator subsystem does not support.
*/
AXP_DESC_FIXED(AXP813, RTC_LDO, "rtc-ldo", "ips", 1800),
AXP_DESC_IO(AXP813, LDO_IO0, "ldo-io0", "ips", 700, 3300, 100,
AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
AXP_DESC_IO(AXP813, LDO_IO1, "ldo-io1", "ips", 700, 3300, 100,
AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
AXP_DESC_SW(AXP813, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(7)),
};

static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
{
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
Expand All @@ -441,9 +505,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
step = 75;
break;
case AXP803_ID:
case AXP813_ID:
/*
* AXP803 DCDC work frequency setting has the same range and
* step as AXP22X, but at a different register.
* AXP803/AXP813 DCDC work frequency setting has the same
* range and step as AXP22X, but at a different register.
* Fall through to the check below.
* (See include/linux/mfd/axp20x.h)
*/
Expand Down Expand Up @@ -561,6 +626,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
workmode <<= id - AXP803_DCDC1;
break;

case AXP813_ID:
if (id < AXP813_DCDC1 || id > AXP813_DCDC7)
return -EINVAL;

mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP813_DCDC1);
workmode <<= id - AXP813_DCDC1;
break;

default:
/* should not happen */
WARN_ON(1);
Expand All @@ -579,8 +652,8 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
u32 reg = 0;

/*
* Currently in our supported AXP variants, only AXP803 and AXP806
* have polyphase regulators.
* Currently in our supported AXP variants, only AXP803, AXP806,
* and AXP813 have polyphase regulators.
*/
switch (axp20x->variant) {
case AXP803_ID:
Expand All @@ -590,7 +663,7 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
case AXP803_DCDC3:
return !!(reg & BIT(6));
case AXP803_DCDC6:
return !!(reg & BIT(7));
return !!(reg & BIT(5));
}
break;

Expand All @@ -608,6 +681,17 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
}
break;

case AXP813_ID:
regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);

switch (id) {
case AXP803_DCDC3:
return !!(reg & BIT(6));
case AXP803_DCDC6:
return !!(reg & BIT(5));
}
break;

default:
return false;
}
Expand Down Expand Up @@ -656,6 +740,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
regulators = axp809_regulators;
nregulators = AXP809_REG_ID_MAX;
break;
case AXP813_ID:
regulators = axp813_regulators;
nregulators = AXP813_REG_ID_MAX;
drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
"x-powers,drive-vbus-en");
break;
default:
dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
axp20x->variant);
Expand All @@ -677,6 +767,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
if (axp20x_is_polyphase_slave(axp20x, i))
continue;

/* Support for AXP813's FLDO3 is not implemented */
if (axp20x->variant == AXP813_ID && i == AXP813_FLDO3)
continue;

/*
* Regulators DC1SW and DC5LDO are connected internally,
* so we have to handle their supply names separately.
Expand Down
3 changes: 3 additions & 0 deletions include/linux/mfd/axp20x.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ enum axp20x_variants {
#define AXP803_DCDC6_V_OUT 0x25
#define AXP803_DCDC_FREQ_CTRL 0x3b

/* Other DCDC regulator control registers are the same as AXP803 */
#define AXP813_DCDC7_V_OUT 0x26

/* Interrupt */
#define AXP152_IRQ1_EN 0x40
#define AXP152_IRQ2_EN 0x41
Expand Down