You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'mfd-next-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Drivers: - Add Cirrus Logic Madera Codec (CS47L35, CS47L85 and CS47L90/91) driver - Add ChromeOS EC CEC driver - Add ROHM BD71837 PMIC driver New Device Support: - Add support for Dialog Semi DA9063L PMIC variant to DA9063 - Add support for Intel Ice Lake to Intel-PLSS-PCI - Add support for X-Powers AXP806 to AXP20x New Functionality: - Add support for USB Charging to the ChromeOS Embedded Controller - Add support for HDMI CEC to the ChromeOS Embedded Controller - Add support for HDMI CEC to Intel HDMI - Add support for accessory detection to Madera devices - Allow individual pins to be configured via DT' wlf,csnaddr-pd - Provide legacy platform specific EEPROM/Watchdog commands; rave-sp Fix-upsL - Trivial renaming/spelling fixes; cros_ec, da9063-* - Convert to Managed Resources (devm_*); da9063-*, ti_am335x_tscadc - Transition to helper macros/functions; da9063-* - Constify; kempld-core - Improve error path/messages; wm8994-core - Disable IRQs locally instead of relying on USB subsystem; dln2 - Remove unused code; rave-sp - New exports; sec-core Bug Fixes: - Fix possible false I2C transaction error; arizona-core - Fix declared memory area size; hi655x-pmic - Fix checksum type; rave-sp - Fix incorrect default serial port configuration: rave-sp - Fix incorrect coherent DMA mask for sub-devices; sm501" * tag 'mfd-next-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (60 commits) mfd: madera: Add register definitions for accessory detect mfd: sm501: Set coherent_dma_mask when creating subdevices mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC mfd: bd71837: Core driver for ROHM BD71837 PMIC media: platform: cros-ec-cec: Fix dependency on MFD_CROS_EC mfd: sec-core: Export OF module alias table mfd: as3722: Disable auto-power-on when AC OK mfd: axp20x: Support AXP806 in I2C mode mfd: axp20x: Add self-working mode support for AXP806 dt-bindings: mfd: axp20x: Add "self-working" mode for AXP806 mfd: wm8994: Allow to configure CS/ADDR Pulldown from dts mfd: wm8994: Allow to configure Speaker Mode Pullup from dts mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support it mfd: rave-sp: Add legacy watchdog ping command translation mfd: rave-sp: Add legacy EEPROM access command translation mfd: rave-sp: Initialize flow control and parity of the port mfd: rave-sp: Fix incorrectly specified checksum type mfd: rave-sp: Remove unused defines mfd: hi655x: Fix regmap area declared size for hi655x mfd: ti_am335x_tscadc: Fix struct clk memory leak ...
This commit is contained in:
@@ -20,6 +20,8 @@ Optional properties:
|
||||
- ams,enable-internal-i2c-pullup: Boolean property, to enable internal pullup on
|
||||
i2c scl/sda pins. Missing this will disable internal pullup on i2c
|
||||
scl/sda lines.
|
||||
- ams,enable-ac-ok-power-on: Boolean property, to enable exit out of power off
|
||||
mode with AC_OK pin (pin enabled in power off mode).
|
||||
|
||||
Optional submodule and their properties:
|
||||
=======================================
|
||||
|
||||
@@ -44,8 +44,11 @@ Optional properties:
|
||||
board is driving OTG VBus or not.
|
||||
(axp221 / axp223 / axp803/ axp813 only)
|
||||
|
||||
- x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is
|
||||
wired for master mode. The default is slave mode.
|
||||
- x-powers,self-working-mode and
|
||||
x-powers,master-mode: Boolean (axp806 only). Set either of these when the
|
||||
PMIC is wired for self-working mode or master mode.
|
||||
If neither is set then slave mode is assumed.
|
||||
This corresponds to how the MODESET pin is wired.
|
||||
|
||||
- <input>-supply: a phandle to the regulator supply node. May be omitted if
|
||||
inputs are unregulated, such as using the IPSOUT output
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
Cirrus Logic Madera class audio codecs Multi-Functional Device
|
||||
|
||||
These devices are audio SoCs with extensive digital capabilities and a range
|
||||
of analogue I/O.
|
||||
|
||||
See also the child driver bindings in:
|
||||
bindings/pinctrl/cirrus,madera-pinctrl.txt
|
||||
bindings/regulator/arizona-regulator.txt
|
||||
bindings/sound/madera.txt
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : One of the following chip-specific strings:
|
||||
"cirrus,cs47l35"
|
||||
"cirrus,cs47l85"
|
||||
"cirrus,cs47l90"
|
||||
"cirrus,cs47l91"
|
||||
"cirrus,wm1840"
|
||||
|
||||
- reg : I2C slave address when connected using I2C, chip select number when
|
||||
using SPI.
|
||||
|
||||
- DCVDD-supply : Power supply for the device as defined in
|
||||
bindings/regulator/regulator.txt
|
||||
Mandatory on CS47L35, CS47L90, CS47L91
|
||||
Optional on CS47L85, WM1840
|
||||
|
||||
- AVDD-supply, DBVDD1-supply, DBVDD2-supply, CPVDD1-supply, CPVDD2-supply :
|
||||
Power supplies for the device
|
||||
|
||||
- DBVDD3-supply, DBVDD4-supply : Power supplies for the device
|
||||
(CS47L85, CS47L90, CS47L91, WM1840)
|
||||
|
||||
- SPKVDDL-supply, SPKVDDR-supply : Power supplies for the device
|
||||
(CS47L85, WM1840)
|
||||
|
||||
- SPKVDD-supply : Power supply for the device
|
||||
(CS47L35)
|
||||
|
||||
- interrupt-controller : Indicates that this device is an interrupt controller
|
||||
|
||||
- #interrupt-cells: the number of cells to describe an IRQ, must be 2.
|
||||
The first cell is the IRQ number.
|
||||
The second cell is the flags, encoded as the trigger masks from
|
||||
bindings/interrupt-controller/interrupts.txt
|
||||
|
||||
- gpio-controller : Indicates this device is a GPIO controller.
|
||||
|
||||
- #gpio-cells : Must be 2. The first cell is the pin number. The second cell
|
||||
is reserved for future use and must be zero
|
||||
|
||||
- interrupt-parent : The parent interrupt controller.
|
||||
|
||||
- interrupts : The interrupt line the /IRQ signal for the device is
|
||||
connected to.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- MICVDD-supply : Power supply, only need to be specified if
|
||||
powered externally
|
||||
|
||||
- reset-gpios : One entry specifying the GPIO controlling /RESET.
|
||||
As defined in bindings/gpio.txt.
|
||||
Although optional, it is strongly recommended to use a hardware reset
|
||||
|
||||
- MICBIASx : Initial data for the MICBIAS regulators, as covered in
|
||||
Documentation/devicetree/bindings/regulator/regulator.txt.
|
||||
One for each MICBIAS generator (MICBIAS1, MICBIAS2, ...)
|
||||
(all codecs)
|
||||
|
||||
One for each output pin (MICBIAS1A, MIBCIAS1B, MICBIAS2A, ...)
|
||||
(all except CS47L85, WM1840)
|
||||
|
||||
The following following additional property is supported for the generator
|
||||
nodes:
|
||||
- cirrus,ext-cap : Set to 1 if the MICBIAS has external decoupling
|
||||
capacitors attached.
|
||||
|
||||
Optional child nodes:
|
||||
micvdd : Node containing initialization data for the micvdd regulator
|
||||
See bindings/regulator/arizona-regulator.txt
|
||||
|
||||
ldo1 : Node containing initialization data for the LDO1 regulator
|
||||
See bindings/regulator/arizona-regulator.txt
|
||||
(cs47l85, wm1840)
|
||||
|
||||
Example:
|
||||
|
||||
cs47l85@0 {
|
||||
compatible = "cirrus,cs47l85";
|
||||
reg = <0>;
|
||||
|
||||
reset-gpios = <&gpio 0>;
|
||||
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
interrupts = <&host_irq1>;
|
||||
interrupt-parent = <&gic>;
|
||||
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
* ROHM BD71837 Power Management Integrated Circuit bindings
|
||||
|
||||
BD71837MWV is a programmable Power Management IC for powering single-core,
|
||||
dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for
|
||||
low BOM cost and compact solution footprint. It integrates 8 Buck
|
||||
egulators and 7 LDOs to provide all the power rails required by the SoC and
|
||||
the commonly used peripherals.
|
||||
|
||||
Datasheet for PMIC is available at:
|
||||
https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
|
||||
|
||||
Required properties:
|
||||
- compatible : Should be "rohm,bd71837".
|
||||
- reg : I2C slave address.
|
||||
- interrupt-parent : Phandle to the parent interrupt controller.
|
||||
- interrupts : The interrupt line the device is connected to.
|
||||
- clocks : The parent clock connected to PMIC. If this is missing
|
||||
32768 KHz clock is assumed.
|
||||
- #clock-cells : Should be 0.
|
||||
- regulators: : List of child nodes that specify the regulators.
|
||||
Please see ../regulator/rohm,bd71837-regulator.txt
|
||||
|
||||
Optional properties:
|
||||
- clock-output-names : Should contain name for output clock.
|
||||
|
||||
Example:
|
||||
|
||||
/* external oscillator node */
|
||||
osc: oscillator {
|
||||
compatible = "fixed-clock";
|
||||
#clock-cells = <1>;
|
||||
clock-frequency = <32768>;
|
||||
clock-output-names = "osc";
|
||||
};
|
||||
|
||||
pmic: pmic@4b {
|
||||
compatible = "rohm,bd71837";
|
||||
reg = <0x4b>;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <29 GPIO_ACTIVE_LOW>;
|
||||
interrupt-names = "irq";
|
||||
#clock-cells = <0>;
|
||||
clocks = <&osc 0>;
|
||||
clock-output-names = "bd71837-32k-out";
|
||||
|
||||
regulators {
|
||||
buck1: BUCK1 {
|
||||
regulator-name = "buck1";
|
||||
regulator-min-microvolt = <700000>;
|
||||
regulator-max-microvolt = <1300000>;
|
||||
regulator-boot-on;
|
||||
regulator-ramp-delay = <1250>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* Clock consumer node */
|
||||
rtc@0 {
|
||||
compatible = "company,my-rtc";
|
||||
clock-names = "my-clock";
|
||||
clocks = <&pmic>;
|
||||
};
|
||||
@@ -22,7 +22,7 @@ Required properties:
|
||||
The valid regulator-compatible values are:
|
||||
tps65910: vrtc, vio, vdd1, vdd2, vdd3, vdig1, vdig2, vpll, vdac, vaux1,
|
||||
vaux2, vaux33, vmmc, vbb
|
||||
tps65911: vrtc, vio, vdd1, vdd3, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
|
||||
tps65911: vrtc, vio, vdd1, vdd2, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
|
||||
ldo6, ldo7, ldo8
|
||||
|
||||
- xxx-supply: Input voltage supply regulator.
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
Cirrus Logic Madera class audio codecs pinctrl driver
|
||||
|
||||
The Cirrus Logic Madera codecs provide a number of GPIO functions for
|
||||
interfacing to external hardware and to provide logic outputs to other devices.
|
||||
Certain groups of GPIO pins also have an alternate function, normally as an
|
||||
audio interface.
|
||||
|
||||
The set of available GPIOs, functions and alternate function groups differs
|
||||
between codecs so refer to the datasheet for the codec for further information
|
||||
on what is supported on that device.
|
||||
|
||||
The properties for this driver exist within the parent MFD driver node.
|
||||
|
||||
See also
|
||||
the core bindings for the parent MFD driver:
|
||||
Documentation/devicetree/bindings/mfd/madera.txt
|
||||
|
||||
the generic pinmix bindings:
|
||||
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
|
||||
|
||||
Required properties of parent mfd node:
|
||||
- pinctrl-names : must be "default"
|
||||
- pinctrl-0 : a phandle to the node containing the subnodes containing default
|
||||
configurations
|
||||
|
||||
Required subnodes:
|
||||
One subnode is required to contain the default settings. It contains an
|
||||
arbitrary number of configuration subnodes, one for each group or pin
|
||||
configuration you want to apply as a default.
|
||||
|
||||
Required properties of configuration subnodes:
|
||||
- groups : name of one pin group to configure. One of:
|
||||
aif1, aif2, aif3, aif4, mif1, mif2, mif3, pdmspk1, pdmspk2,
|
||||
dmic4, dmic5, dmic6,
|
||||
gpio1, gpio2, ..., gpio40
|
||||
The gpioN groups select the single pin of this name for configuration
|
||||
|
||||
Optional properties of configuration subnodes:
|
||||
Any configuration option not explicitly listed in the dts will be left at
|
||||
chip default setting.
|
||||
|
||||
- function : name of function to assign to this group. One of:
|
||||
aif1, aif2, aif3, aif4, mif1, mif2, mif3, pdmspk1, pdmspk2,
|
||||
dmic3, dmic4, dmic5, dmic6,
|
||||
io, dsp-gpio, irq1, irq2,
|
||||
fll1-clk, fll1-lock, fll2-clk, fll2-lock, fll3-clk, fll3-lock,
|
||||
fllao-clk, fllao-lock,
|
||||
opclk, opclk-async, pwm1, pwm2, spdif,
|
||||
asrc1-in1-lock, asrc1-in2-lock, asrc2-in1-lock, asrc2-in2-lock,
|
||||
spkl-short-circuit, spkr-short-circuit, spk-shutdown,
|
||||
spk-overheat-shutdown, spk-overheat-warn,
|
||||
timer1-sts, timer2-sts, timer3-sts, timer4-sts, timer5-sts, timer6-sts,
|
||||
timer7-sts, timer8-sts,
|
||||
log1-fifo-ne, log2-fifo-ne, log3-fifo-ne, log4-fifo-ne, log5-fifo-ne,
|
||||
log6-fifo-ne, log7-fifo-ne, log8-fifo-ne,
|
||||
|
||||
- bias-disable : disable pull-up and pull-down
|
||||
- bias-bus-hold : enable buskeeper
|
||||
- bias-pull-up : output is pulled-up
|
||||
- bias-pull-down : output is pulled-down
|
||||
- drive-push-pull : CMOS output
|
||||
- drive-open-drain : open-drain output
|
||||
- drive-strength : drive strength in mA. Valid values are 4 or 8
|
||||
- input-schmitt-enable : enable schmitt-trigger mode
|
||||
- input-schmitt-disable : disable schmitt-trigger mode
|
||||
- input-debounce : A value of 0 disables debounce, a value !=0 enables
|
||||
debounce
|
||||
- output-low : set the pin to output mode with low level
|
||||
- output-high : set the pin to output mode with high level
|
||||
|
||||
Example:
|
||||
|
||||
cs47l85@0 {
|
||||
compatible = "cirrus,cs47l85";
|
||||
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&cs47l85_defaults>;
|
||||
|
||||
cs47l85_defaults: cs47l85-gpio-defaults {
|
||||
aif1 {
|
||||
groups = "aif1";
|
||||
function = "aif1";
|
||||
bias-bus-hold;
|
||||
};
|
||||
|
||||
aif2 {
|
||||
groups = "aif2";
|
||||
function = "aif2";
|
||||
bias-bus-hold;
|
||||
};
|
||||
|
||||
opclk {
|
||||
groups = "gpio1";
|
||||
function = "opclk";
|
||||
bias-pull-up;
|
||||
drive-strength = <8>;
|
||||
};
|
||||
};
|
||||
};
|
||||
+16
@@ -3562,6 +3562,22 @@ M: Christian Benvenuti <benve@cisco.com>
|
||||
S: Supported
|
||||
F: drivers/infiniband/hw/usnic/
|
||||
|
||||
CIRRUS LOGIC MADERA CODEC DRIVERS
|
||||
M: Charles Keepax <ckeepax@opensource.cirrus.com>
|
||||
M: Richard Fitzgerald <rf@opensource.cirrus.com>
|
||||
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
|
||||
L: patches@opensource.cirrus.com
|
||||
T: git https://github.com/CirrusLogic/linux-drivers.git
|
||||
W: https://github.com/CirrusLogic/linux-drivers/wiki
|
||||
S: Supported
|
||||
F: Documentation/devicetree/bindings/mfd/madera.txt
|
||||
F: Documentation/devicetree/bindings/pinctrl/cirrus,madera-pinctrl.txt
|
||||
F: include/linux/mfd/madera/*
|
||||
F: drivers/gpio/gpio-madera*
|
||||
F: drivers/mfd/madera*
|
||||
F: drivers/mfd/cs47l*
|
||||
F: drivers/pinctrl/cirrus/*
|
||||
|
||||
CLANG-FORMAT FILE
|
||||
M: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
|
||||
S: Maintained
|
||||
|
||||
@@ -155,8 +155,8 @@ CONFIG_THERMAL_EMULATION=y
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_S3C2410_WATCHDOG=y
|
||||
CONFIG_MFD_CROS_EC=y
|
||||
CONFIG_MFD_CROS_EC_I2C=y
|
||||
CONFIG_MFD_CROS_EC_SPI=y
|
||||
CONFIG_CROS_EC_I2C=y
|
||||
CONFIG_CROS_EC_SPI=y
|
||||
CONFIG_MFD_MAX14577=y
|
||||
CONFIG_MFD_MAX77686=y
|
||||
CONFIG_MFD_MAX77693=y
|
||||
|
||||
@@ -490,8 +490,8 @@ CONFIG_MFD_AC100=y
|
||||
CONFIG_MFD_AXP20X_I2C=y
|
||||
CONFIG_MFD_AXP20X_RSB=y
|
||||
CONFIG_MFD_CROS_EC=m
|
||||
CONFIG_MFD_CROS_EC_I2C=m
|
||||
CONFIG_MFD_CROS_EC_SPI=m
|
||||
CONFIG_CROS_EC_I2C=m
|
||||
CONFIG_CROS_EC_SPI=m
|
||||
CONFIG_MFD_DA9063=m
|
||||
CONFIG_MFD_MAX14577=y
|
||||
CONFIG_MFD_MAX77686=y
|
||||
|
||||
@@ -398,8 +398,8 @@ CONFIG_MFD_AS3711=y
|
||||
CONFIG_MFD_BCM590XX=m
|
||||
CONFIG_MFD_AXP20X=y
|
||||
CONFIG_MFD_CROS_EC=m
|
||||
CONFIG_MFD_CROS_EC_I2C=m
|
||||
CONFIG_MFD_CROS_EC_SPI=m
|
||||
CONFIG_CROS_EC_I2C=m
|
||||
CONFIG_CROS_EC_SPI=m
|
||||
CONFIG_MFD_ASIC3=y
|
||||
CONFIG_PMIC_DA903X=y
|
||||
CONFIG_HTC_EGPIO=y
|
||||
|
||||
@@ -373,8 +373,8 @@ CONFIG_UNIPHIER_WATCHDOG=y
|
||||
CONFIG_BCM2835_WDT=y
|
||||
CONFIG_MFD_AXP20X_RSB=y
|
||||
CONFIG_MFD_CROS_EC=y
|
||||
CONFIG_MFD_CROS_EC_I2C=y
|
||||
CONFIG_MFD_CROS_EC_SPI=y
|
||||
CONFIG_CROS_EC_I2C=y
|
||||
CONFIG_CROS_EC_SPI=y
|
||||
CONFIG_MFD_CROS_EC_CHARDEV=m
|
||||
CONFIG_MFD_EXYNOS_LPASS=m
|
||||
CONFIG_MFD_HI6421_PMIC=y
|
||||
|
||||
@@ -1049,6 +1049,12 @@ config GPIO_LP87565
|
||||
This driver can also be built as a module. If so, the module will be
|
||||
called gpio-lp87565.
|
||||
|
||||
config GPIO_MADERA
|
||||
tristate "Cirrus Logic Madera class codecs"
|
||||
depends on PINCTRL_MADERA
|
||||
help
|
||||
Support for GPIOs on Cirrus Logic Madera class codecs.
|
||||
|
||||
config GPIO_MAX77620
|
||||
tristate "GPIO support for PMIC MAX77620 and MAX20024"
|
||||
depends on MFD_MAX77620
|
||||
|
||||
@@ -71,6 +71,7 @@ obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o
|
||||
obj-$(CONFIG_GPIO_LP873X) += gpio-lp873x.o
|
||||
obj-$(CONFIG_GPIO_LP87565) += gpio-lp87565.o
|
||||
obj-$(CONFIG_GPIO_LYNXPOINT) += gpio-lynxpoint.o
|
||||
obj-$(CONFIG_GPIO_MADERA) += gpio-madera.o
|
||||
obj-$(CONFIG_GPIO_MAX3191X) += gpio-max3191x.o
|
||||
obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o
|
||||
obj-$(CONFIG_GPIO_MAX7300) += gpio-max7300.o
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* GPIO support for Cirrus Logic Madera codecs
|
||||
*
|
||||
* Copyright (C) 2015-2018 Cirrus Logic
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; version 2.
|
||||
*/
|
||||
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
#include <linux/mfd/madera/core.h>
|
||||
#include <linux/mfd/madera/pdata.h>
|
||||
#include <linux/mfd/madera/registers.h>
|
||||
|
||||
struct madera_gpio {
|
||||
struct madera *madera;
|
||||
/* storage space for the gpio_chip we're using */
|
||||
struct gpio_chip gpio_chip;
|
||||
};
|
||||
|
||||
static int madera_gpio_get_direction(struct gpio_chip *chip,
|
||||
unsigned int offset)
|
||||
{
|
||||
struct madera_gpio *madera_gpio = gpiochip_get_data(chip);
|
||||
struct madera *madera = madera_gpio->madera;
|
||||
unsigned int reg_offset = 2 * offset;
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = regmap_read(madera->regmap, MADERA_GPIO1_CTRL_2 + reg_offset,
|
||||
&val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return !!(val & MADERA_GP1_DIR_MASK);
|
||||
}
|
||||
|
||||
static int madera_gpio_direction_in(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct madera_gpio *madera_gpio = gpiochip_get_data(chip);
|
||||
struct madera *madera = madera_gpio->madera;
|
||||
unsigned int reg_offset = 2 * offset;
|
||||
|
||||
return regmap_update_bits(madera->regmap,
|
||||
MADERA_GPIO1_CTRL_2 + reg_offset,
|
||||
MADERA_GP1_DIR_MASK, MADERA_GP1_DIR);
|
||||
}
|
||||
|
||||
static int madera_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct madera_gpio *madera_gpio = gpiochip_get_data(chip);
|
||||
struct madera *madera = madera_gpio->madera;
|
||||
unsigned int reg_offset = 2 * offset;
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = regmap_read(madera->regmap, MADERA_GPIO1_CTRL_1 + reg_offset,
|
||||
&val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return !!(val & MADERA_GP1_LVL_MASK);
|
||||
}
|
||||
|
||||
static int madera_gpio_direction_out(struct gpio_chip *chip,
|
||||
unsigned int offset, int value)
|
||||
{
|
||||
struct madera_gpio *madera_gpio = gpiochip_get_data(chip);
|
||||
struct madera *madera = madera_gpio->madera;
|
||||
unsigned int reg_offset = 2 * offset;
|
||||
unsigned int reg_val = value ? MADERA_GP1_LVL : 0;
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(madera->regmap,
|
||||
MADERA_GPIO1_CTRL_2 + reg_offset,
|
||||
MADERA_GP1_DIR_MASK, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return regmap_update_bits(madera->regmap,
|
||||
MADERA_GPIO1_CTRL_1 + reg_offset,
|
||||
MADERA_GP1_LVL_MASK, reg_val);
|
||||
}
|
||||
|
||||
static void madera_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
int value)
|
||||
{
|
||||
struct madera_gpio *madera_gpio = gpiochip_get_data(chip);
|
||||
struct madera *madera = madera_gpio->madera;
|
||||
unsigned int reg_offset = 2 * offset;
|
||||
unsigned int reg_val = value ? MADERA_GP1_LVL : 0;
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(madera->regmap,
|
||||
MADERA_GPIO1_CTRL_1 + reg_offset,
|
||||
MADERA_GP1_LVL_MASK, reg_val);
|
||||
|
||||
/* set() doesn't return an error so log a warning */
|
||||
if (ret)
|
||||
dev_warn(madera->dev, "Failed to write to 0x%x (%d)\n",
|
||||
MADERA_GPIO1_CTRL_1 + reg_offset, ret);
|
||||
}
|
||||
|
||||
static struct gpio_chip madera_gpio_chip = {
|
||||
.label = "madera",
|
||||
.owner = THIS_MODULE,
|
||||
.request = gpiochip_generic_request,
|
||||
.free = gpiochip_generic_free,
|
||||
.get_direction = madera_gpio_get_direction,
|
||||
.direction_input = madera_gpio_direction_in,
|
||||
.get = madera_gpio_get,
|
||||
.direction_output = madera_gpio_direction_out,
|
||||
.set = madera_gpio_set,
|
||||
.set_config = gpiochip_generic_config,
|
||||
.can_sleep = true,
|
||||
};
|
||||
|
||||
static int madera_gpio_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct madera *madera = dev_get_drvdata(pdev->dev.parent);
|
||||
struct madera_pdata *pdata = dev_get_platdata(madera->dev);
|
||||
struct madera_gpio *madera_gpio;
|
||||
int ret;
|
||||
|
||||
madera_gpio = devm_kzalloc(&pdev->dev, sizeof(*madera_gpio),
|
||||
GFP_KERNEL);
|
||||
if (!madera_gpio)
|
||||
return -ENOMEM;
|
||||
|
||||
madera_gpio->madera = madera;
|
||||
|
||||
/* Construct suitable gpio_chip from the template in madera_gpio_chip */
|
||||
madera_gpio->gpio_chip = madera_gpio_chip;
|
||||
madera_gpio->gpio_chip.parent = pdev->dev.parent;
|
||||
|
||||
switch (madera->type) {
|
||||
case CS47L35:
|
||||
madera_gpio->gpio_chip.ngpio = CS47L35_NUM_GPIOS;
|
||||
break;
|
||||
case CS47L85:
|
||||
case WM1840:
|
||||
madera_gpio->gpio_chip.ngpio = CS47L85_NUM_GPIOS;
|
||||
break;
|
||||
case CS47L90:
|
||||
case CS47L91:
|
||||
madera_gpio->gpio_chip.ngpio = CS47L90_NUM_GPIOS;
|
||||
break;
|
||||
default:
|
||||
dev_err(&pdev->dev, "Unknown chip variant %d\n", madera->type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* We want to be usable on systems that don't use devicetree or acpi */
|
||||
if (pdata && pdata->gpio_base)
|
||||
madera_gpio->gpio_chip.base = pdata->gpio_base;
|
||||
else
|
||||
madera_gpio->gpio_chip.base = -1;
|
||||
|
||||
ret = devm_gpiochip_add_data(&pdev->dev,
|
||||
&madera_gpio->gpio_chip,
|
||||
madera_gpio);
|
||||
if (ret < 0) {
|
||||
dev_dbg(&pdev->dev, "Could not register gpiochip, %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is part of a composite MFD device which can only be used with
|
||||
* the corresponding pinctrl driver. On all supported silicon the GPIO
|
||||
* to pinctrl mapping is fixed in the silicon, so we register it
|
||||
* explicitly instead of requiring a redundant gpio-ranges in the
|
||||
* devicetree.
|
||||
* In any case we also want to work on systems that don't use devicetree
|
||||
* or acpi.
|
||||
*/
|
||||
ret = gpiochip_add_pin_range(&madera_gpio->gpio_chip, "madera-pinctrl",
|
||||
0, 0, madera_gpio->gpio_chip.ngpio);
|
||||
if (ret) {
|
||||
dev_dbg(&pdev->dev, "Failed to add pin range (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver madera_gpio_driver = {
|
||||
.driver = {
|
||||
.name = "madera-gpio",
|
||||
},
|
||||
.probe = madera_gpio_probe,
|
||||
};
|
||||
|
||||
module_platform_driver(madera_gpio_driver);
|
||||
|
||||
MODULE_SOFTDEP("pre: pinctrl-madera");
|
||||
MODULE_DESCRIPTION("GPIO interface for Madera codecs");
|
||||
MODULE_AUTHOR("Nariman Poushin <nariman@opensource.cirrus.com>");
|
||||
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_ALIAS("platform:madera-gpio");
|
||||
@@ -24,6 +24,7 @@ config DRM_I915
|
||||
select IOSF_MBI
|
||||
select CRC32
|
||||
select SND_HDA_I915 if SND_HDA_CORE
|
||||
select CEC_CORE if CEC_NOTIFIER
|
||||
help
|
||||
Choose this option if you have a system that has "Intel Graphics
|
||||
Media Accelerator" or "HD Graphics" integrated graphics,
|
||||
|
||||
@@ -126,6 +126,30 @@ enum port {
|
||||
|
||||
#define port_name(p) ((p) + 'A')
|
||||
|
||||
/*
|
||||
* Ports identifier referenced from other drivers.
|
||||
* Expected to remain stable over time
|
||||
*/
|
||||
static inline const char *port_identifier(enum port port)
|
||||
{
|
||||
switch (port) {
|
||||
case PORT_A:
|
||||
return "Port A";
|
||||
case PORT_B:
|
||||
return "Port B";
|
||||
case PORT_C:
|
||||
return "Port C";
|
||||
case PORT_D:
|
||||
return "Port D";
|
||||
case PORT_E:
|
||||
return "Port E";
|
||||
case PORT_F:
|
||||
return "Port F";
|
||||
default:
|
||||
return "<invalid>";
|
||||
}
|
||||
}
|
||||
|
||||
enum tc_port {
|
||||
PORT_TC_NONE = -1,
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <drm/drm_dp_mst_helper.h>
|
||||
#include <drm/drm_rect.h>
|
||||
#include <drm/drm_atomic.h>
|
||||
#include <media/cec-notifier.h>
|
||||
|
||||
/**
|
||||
* __wait_for - magic wait macro
|
||||
@@ -1016,6 +1017,7 @@ struct intel_hdmi {
|
||||
bool has_audio;
|
||||
bool rgb_quant_range_selectable;
|
||||
struct intel_connector *attached_connector;
|
||||
struct cec_notifier *cec_notifier;
|
||||
};
|
||||
|
||||
struct intel_dp_mst_encoder;
|
||||
|
||||
@@ -1899,6 +1899,8 @@ intel_hdmi_set_edid(struct drm_connector *connector)
|
||||
connected = true;
|
||||
}
|
||||
|
||||
cec_notifier_set_phys_addr_from_edid(intel_hdmi->cec_notifier, edid);
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
@@ -1907,6 +1909,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
|
||||
{
|
||||
enum drm_connector_status status;
|
||||
struct drm_i915_private *dev_priv = to_i915(connector->dev);
|
||||
struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
|
||||
|
||||
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
|
||||
connector->base.id, connector->name);
|
||||
@@ -1922,6 +1925,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
|
||||
|
||||
intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
|
||||
|
||||
if (status != connector_status_connected)
|
||||
cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -2062,6 +2068,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
|
||||
|
||||
static void intel_hdmi_destroy(struct drm_connector *connector)
|
||||
{
|
||||
if (intel_attached_hdmi(connector)->cec_notifier)
|
||||
cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier);
|
||||
kfree(to_intel_connector(connector)->detect_edid);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(connector);
|
||||
@@ -2382,6 +2390,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
|
||||
u32 temp = I915_READ(PEG_BAND_GAP_DATA);
|
||||
I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
|
||||
}
|
||||
|
||||
intel_hdmi->cec_notifier = cec_notifier_get_conn(dev->dev,
|
||||
port_identifier(port));
|
||||
if (!intel_hdmi->cec_notifier)
|
||||
DRM_DEBUG_KMS("CEC notifier get failed\n");
|
||||
}
|
||||
|
||||
void intel_hdmi_init(struct drm_i915_private *dev_priv,
|
||||
|
||||
@@ -721,7 +721,7 @@ config KEYBOARD_CROS_EC
|
||||
help
|
||||
Say Y here to enable the matrix keyboard used by ChromeOS devices
|
||||
and implemented on the ChromeOS EC. You must enable one bus option
|
||||
(MFD_CROS_EC_I2C or MFD_CROS_EC_SPI) to use this.
|
||||
(CROS_EC_I2C or CROS_EC_SPI) to use this.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called cros_ec_keyb.
|
||||
|
||||
@@ -21,6 +21,7 @@ struct cec_notifier {
|
||||
struct list_head head;
|
||||
struct kref kref;
|
||||
struct device *dev;
|
||||
const char *conn;
|
||||
struct cec_adapter *cec_adap;
|
||||
void (*callback)(struct cec_adapter *adap, u16 pa);
|
||||
|
||||
@@ -30,13 +31,14 @@ struct cec_notifier {
|
||||
static LIST_HEAD(cec_notifiers);
|
||||
static DEFINE_MUTEX(cec_notifiers_lock);
|
||||
|
||||
struct cec_notifier *cec_notifier_get(struct device *dev)
|
||||
struct cec_notifier *cec_notifier_get_conn(struct device *dev, const char *conn)
|
||||
{
|
||||
struct cec_notifier *n;
|
||||
|
||||
mutex_lock(&cec_notifiers_lock);
|
||||
list_for_each_entry(n, &cec_notifiers, head) {
|
||||
if (n->dev == dev) {
|
||||
if (n->dev == dev &&
|
||||
(!conn || !strcmp(n->conn, conn))) {
|
||||
kref_get(&n->kref);
|
||||
mutex_unlock(&cec_notifiers_lock);
|
||||
return n;
|
||||
@@ -46,6 +48,8 @@ struct cec_notifier *cec_notifier_get(struct device *dev)
|
||||
if (!n)
|
||||
goto unlock;
|
||||
n->dev = dev;
|
||||
if (conn)
|
||||
n->conn = kstrdup(conn, GFP_KERNEL);
|
||||
n->phys_addr = CEC_PHYS_ADDR_INVALID;
|
||||
mutex_init(&n->lock);
|
||||
kref_init(&n->kref);
|
||||
@@ -54,7 +58,7 @@ unlock:
|
||||
mutex_unlock(&cec_notifiers_lock);
|
||||
return n;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cec_notifier_get);
|
||||
EXPORT_SYMBOL_GPL(cec_notifier_get_conn);
|
||||
|
||||
static void cec_notifier_release(struct kref *kref)
|
||||
{
|
||||
@@ -62,6 +66,7 @@ static void cec_notifier_release(struct kref *kref)
|
||||
container_of(kref, struct cec_notifier, kref);
|
||||
|
||||
list_del(&n->head);
|
||||
kfree(n->conn);
|
||||
kfree(n);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user