Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a8d3e24 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Linus Walleij
Browse files

pinctrl: palmas: add pincontrol driver



TI Palmas series Power Management IC have multiple pins which can be
configured for different functionality. This pins can be configured
for different function. Also their properties like pull up/down,
open drain enable/disable are configurable.

Add support for pincontrol driver Palmas series device like TPS65913,
TPS80036. The driver supports to be register from DT only.

Changes from V1:
- Add generic property for pins and functions in pinconf-generic.
- Add APIs to map the DT and subnode.
- Move common utils APIs to the pinctrl-utils from this file.
- Update the binding document accordingly.
Changes from V2:
- Add ack by Lee.
- Correct the binding docs.

Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent e81c8f18
Loading
Loading
Loading
Loading
+96 −0
Original line number Diff line number Diff line
Palmas Pincontrol bindings

The pins of Palmas device can be set on different option and provides
the configuration for Pull UP/DOWN, open drain etc.

Required properties:
- compatible: It must be one of following:
  - "ti,palmas-pinctrl" for Palma series of the pincontrol.
  - "ti,tps65913-pinctrl" for Palma series device TPS65913.
  - "ti,tps80036-pinctrl" for Palma series device TPS80036.

Please refer to pinctrl-bindings.txt in this directory for details of the
common pinctrl bindings used by client devices, including the meaning of the
phrase "pin configuration node".

Palmas's pin configuration nodes act as a container for an arbitrary number of
subnodes. Each of these subnodes represents some desired configuration for a
list of pins. This configuration can include the mux function to select on
those pin(s), and various pin configuration parameters, such as pull-up,
open drain.

The name of each subnode is not important; all subnodes should be enumerated
and processed purely based on their content.

Each subnode only affects those parameters that are explicitly listed. In
other words, a subnode that lists a mux function but no pin configuration
parameters implies no information about any pin configuration parameters.
Similarly, a pin subnode that describes a pullup parameter implies no
information about e.g. the mux function.

Optional properties:
- ti,palmas-enable-dvfs1: Enable DVFS1. Configure pins for DVFS1 mode.
	Selection primary or secondary function associated to I2C2_SCL_SCE,
	I2C2_SDA_SDO pin/pad for DVFS1 interface
- ti,palmas-enable-dvfs2: Enable DVFS2. Configure pins for DVFS2 mode.
	Selection primary or secondary function associated to GPADC_START
	and SYSEN2 pin/pad for DVFS2 interface

This binding uses the following generic properties as defined in
pinctrl-bindings.txt:

Required: pins
Options: function, bias-disable, bias-pull-up, bias-pull-down,
	 bias-pin-default, drive-open-drain.

Note that many of these properties are only valid for certain specific pins.
See the Palmas device datasheet for complete details regarding which pins
support which functionality.

Valid values for pin names are:
	gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, gpio8, gpio9,
	gpio10, gpio11, gpio12, gpio13, gpio14, gpio15, vac, powergood,
	nreswarm, pwrdown, gpadc_start, reset_in, nsleep, enable1, enable2,
	int.

Valid value of function names are:
	gpio, led, pwm, regen, sysen, clk32kgaudio, id, vbus_det, chrg_det,
	vac, vacok, powergood, usb_psel, msecure, pwrhold, int, nreswarm,
	simrsto, simrsti, low_vbat, wireless_chrg1, rcm, pwrdown, gpadc_start,
	reset_in, nsleep, enable.

There are 4 special functions: opt0, opt1, opt2 and opt3. If any of these
functions is selected then directly pins register will be written with 0, 1, 2
or 3 respectively if it is valid for that pins or list of pins.

Example:
	palmas: tps65913 {
		....
		pinctrl {
			compatible = "ti,tps65913-pinctrl";
			ti,palmas-enable-dvfs1;
			pinctrl-names = "default";
			pinctrl-0 = <&palmas_pins_state>;

			palmas_pins_state: pinmux {
				gpio0 {
					pins = "gpio0";
					function = "id";
					bias-pull-up;
				};

				vac {
					pins = "vac";
					function = "vacok";
					bias-pull-down;
				};

				gpio5 {
					pins = "gpio5";
					function = "opt0";
					drive-open-drain = <1>;
				};
			};
		};
		....
	};
+10 −0
Original line number Diff line number Diff line
@@ -261,6 +261,16 @@ config PINCTRL_EXYNOS5440
	select PINMUX
	select PINCONF

config PINCTRL_PALMAS
	bool "Pinctrl driver for the PALMA Series MFD devices"
	depends on OF && MFD_PALMAS
	select GENERIC_PINCONF
	help
	  Palmas device supports the configuration of pins for different
	  functionality. This driver supports the pinmux, push-pull and
	  open drain configuration for the Palmas series devices like
	  TPS65913, TPS80036 etc.

config PINCTRL_S3C24XX
	bool "Samsung S3C24XX SoC pinctrl driver"
	depends on ARCH_S3C24XX
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
obj-$(CONFIG_PINCTRL_STN8815)	+= pinctrl-nomadik-stn8815.o
obj-$(CONFIG_PINCTRL_DB8500)	+= pinctrl-nomadik-db8500.o
obj-$(CONFIG_PINCTRL_DB8540)	+= pinctrl-nomadik-db8540.o
obj-$(CONFIG_PINCTRL_PALMAS)	+= pinctrl-palmas.o
obj-$(CONFIG_PINCTRL_ROCKCHIP)	+= pinctrl-rockchip.o
obj-$(CONFIG_PINCTRL_SINGLE)	+= pinctrl-single.o
obj-$(CONFIG_PINCTRL_SIRF)	+= sirf/
+1085 −0

File added.

Preview size limit exceeded, changes collapsed.

+24 −11
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ enum usb_irq_events {
#define PALMAS_DVFS_BASE					0x180
#define PALMAS_PMU_CONTROL_BASE					0x1A0
#define PALMAS_RESOURCE_BASE					0x1D4
#define PALMAS_PU_PD_OD_BASE					0x1F4
#define PALMAS_PU_PD_OD_BASE					0x1F0
#define PALMAS_LED_BASE						0x200
#define PALMAS_INTERRUPT_BASE					0x210
#define PALMAS_USB_OTG_BASE					0x250
@@ -1734,16 +1734,20 @@ enum usb_irq_events {
#define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT			0

/* Registers for function PAD_CONTROL */
#define PALMAS_PU_PD_INPUT_CTRL1				0x0
#define PALMAS_PU_PD_INPUT_CTRL2				0x1
#define PALMAS_PU_PD_INPUT_CTRL3				0x2
#define PALMAS_OD_OUTPUT_CTRL					0x4
#define PALMAS_POLARITY_CTRL					0x5
#define PALMAS_PRIMARY_SECONDARY_PAD1				0x6
#define PALMAS_PRIMARY_SECONDARY_PAD2				0x7
#define PALMAS_I2C_SPI						0x8
#define PALMAS_PU_PD_INPUT_CTRL4				0x9
#define PALMAS_PRIMARY_SECONDARY_PAD3				0xA
#define PALMAS_OD_OUTPUT_CTRL2					0x2
#define PALMAS_POLARITY_CTRL2					0x3
#define PALMAS_PU_PD_INPUT_CTRL1				0x4
#define PALMAS_PU_PD_INPUT_CTRL2				0x5
#define PALMAS_PU_PD_INPUT_CTRL3				0x6
#define PALMAS_PU_PD_INPUT_CTRL5				0x7
#define PALMAS_OD_OUTPUT_CTRL					0x8
#define PALMAS_POLARITY_CTRL					0x9
#define PALMAS_PRIMARY_SECONDARY_PAD1				0xA
#define PALMAS_PRIMARY_SECONDARY_PAD2				0xB
#define PALMAS_I2C_SPI						0xC
#define PALMAS_PU_PD_INPUT_CTRL4				0xD
#define PALMAS_PRIMARY_SECONDARY_PAD3				0xE
#define PALMAS_PRIMARY_SECONDARY_PAD4				0xF

/* Bit definitions for PU_PD_INPUT_CTRL1 */
#define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD			0x40
@@ -2501,6 +2505,15 @@ enum usb_irq_events {
#define PALMAS_PU_PD_GPIO_CTRL1					0x6
#define PALMAS_PU_PD_GPIO_CTRL2					0x7
#define PALMAS_OD_OUTPUT_GPIO_CTRL				0x8
#define PALMAS_GPIO_DATA_IN2					0x9
#define PALMAS_GPIO_DATA_DIR2					0x0A
#define PALMAS_GPIO_DATA_OUT2					0x0B
#define PALMAS_GPIO_DEBOUNCE_EN2				0x0C
#define PALMAS_GPIO_CLEAR_DATA_OUT2				0x0D
#define PALMAS_GPIO_SET_DATA_OUT2				0x0E
#define PALMAS_PU_PD_GPIO_CTRL3					0x0F
#define PALMAS_PU_PD_GPIO_CTRL4					0x10
#define PALMAS_OD_OUTPUT_GPIO_CTRL2				0x11

/* Bit definitions for GPIO_DATA_IN */
#define PALMAS_GPIO_DATA_IN_GPIO_7_IN				0x80