Commit af82455f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'char-misc-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
 "Here is the big set of new char/misc driver drivers and features for
  4.12-rc1.

  There's lots of new drivers added this time around, new firmware
  drivers from Google, more auxdisplay drivers, extcon drivers, fpga
  drivers, and a bunch of other driver updates. Nothing major, except if
  you happen to have the hardware for these drivers, and then you will
  be happy :)

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'char-misc-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (136 commits)
  firmware: google memconsole: Fix return value check in platform_memconsole_init()
  firmware: Google VPD: Fix return value check in vpd_platform_init()
  goldfish_pipe: fix build warning about using too much stack.
  goldfish_pipe: An implementation of more parallel pipe
  fpga fr br: update supported version numbers
  fpga: region: release FPGA region reference in error path
  fpga altera-hps2fpga: disable/unprepare clock on error in alt_fpga_bridge_probe()
  mei: drop the TODO from samples
  firmware: Google VPD sysfs driver
  firmware: Google VPD: import lib_vpd source files
  misc: lkdtm: Add volatile to intentional NULL pointer reference
  eeprom: idt_89hpesx: Add OF device ID table
  misc: ds1682: Add OF device ID table
  misc: tsl2550: Add OF device ID table
  w1: Remove unneeded use of assert() and remove w1_log.h
  w1: Use kernel common min() implementation
  uio_mf624: Align memory regions to page size and set correct offsets
  uio_mf624: Refactor memory info initialization
  uio: Allow handling of non page-aligned memory regions
  hangcheck-timer: Fix typo in comment
  ...
parents 0be75179 2a76f89f
...@@ -128,9 +128,6 @@ ...@@ -128,9 +128,6 @@
</sect1> </sect1>
<sect1 id="Device_model_support"><title>Device model support</title> <sect1 id="Device_model_support"><title>Device model support</title>
!Idrivers/rapidio/rio-driver.c !Idrivers/rapidio/rio-driver.c
</sect1>
<sect1 id="Sysfs_support"><title>Sysfs support</title>
!Idrivers/rapidio/rio-sysfs.c
</sect1> </sect1>
<sect1 id="PPC32_support"><title>PPC32 support</title> <sect1 id="PPC32_support"><title>PPC32 support</title>
!Iarch/powerpc/sysdev/fsl_rio.c !Iarch/powerpc/sysdev/fsl_rio.c
......
DT bindings for the Hitachi HD44780 Character LCD Controller
The Hitachi HD44780 Character LCD Controller is commonly used on character LCDs
that can display one or more lines of text. It exposes an M6800 bus interface,
which can be used in either 4-bit or 8-bit mode.
Required properties:
- compatible: Must contain "hit,hd44780",
- data-gpios: Must contain an array of either 4 or 8 GPIO specifiers,
referring to the GPIO pins connected to the data signal lines DB0-DB7
(8-bit mode) or DB4-DB7 (4-bit mode) of the LCD Controller's bus interface,
- enable-gpios: Must contain a GPIO specifier, referring to the GPIO pin
connected to the "E" (Enable) signal line of the LCD Controller's bus
interface,
- rs-gpios: Must contain a GPIO specifier, referring to the GPIO pin
connected to the "RS" (Register Select) signal line of the LCD Controller's
bus interface,
- display-height-chars: Height of the display, in character cells,
- display-width-chars: Width of the display, in character cells.
Optional properties:
- rw-gpios: Must contain a GPIO specifier, referring to the GPIO pin
connected to the "RW" (Read/Write) signal line of the LCD Controller's bus
interface,
- backlight-gpios: Must contain a GPIO specifier, referring to the GPIO pin
used for enabling the LCD's backlight,
- internal-buffer-width: Internal buffer width (default is 40 for displays
with 1 or 2 lines, and display-width-chars for displays with more than 2
lines).
Example:
auxdisplay {
compatible = "hit,hd44780";
data-gpios = <&hc595 0 GPIO_ACTIVE_HIGH>,
<&hc595 1 GPIO_ACTIVE_HIGH>,
<&hc595 2 GPIO_ACTIVE_HIGH>,
<&hc595 3 GPIO_ACTIVE_HIGH>;
enable-gpios = <&hc595 4 GPIO_ACTIVE_HIGH>;
rs-gpios = <&hc595 5 GPIO_ACTIVE_HIGH>;
display-height-chars = <2>;
display-width-chars = <16>;
};
COREBOOT firmware information
The device tree node to communicate the location of coreboot's memory-resident
bookkeeping structures to the kernel. Since coreboot itself cannot boot a
device-tree-based kernel (yet), this node needs to be inserted by a
second-stage bootloader (a coreboot "payload").
Required properties:
- compatible: Should be "coreboot"
- reg: Address and length of the following two memory regions, in order:
1.) The coreboot table. This is a list of variable-sized descriptors
that contain various compile- and run-time generated firmware
parameters. It is identified by the magic string "LBIO" in its first
four bytes.
See coreboot's src/commonlib/include/commonlib/coreboot_tables.h for
details.
2.) The CBMEM area. This is a downward-growing memory region used by
coreboot to dynamically allocate data structures that remain resident.
It may or may not include the coreboot table as one of its members. It
is identified by a root node descriptor with the magic number
0xc0389481 that resides in the topmost 8 bytes of the area.
See coreboot's src/include/imd.h for details.
Example:
firmware {
ranges;
coreboot {
compatible = "coreboot";
reg = <0xfdfea000 0x264>,
<0xfdfea000 0x16000>;
}
};
Altera Arria10 Partial Reconfiguration IP
Required properties:
- compatible : should contain "altr,a10-pr-ip"
- reg : base address and size for memory mapped io.
Example:
fpga_mgr: fpga-mgr@ff20c000 {
compatible = "altr,a10-pr-ip";
reg = <0xff20c000 0x10>;
};
...@@ -186,6 +186,7 @@ Optional properties: ...@@ -186,6 +186,7 @@ Optional properties:
otherwise full reconfiguration is done. otherwise full reconfiguration is done.
- external-fpga-config : boolean, set if the FPGA has already been configured - external-fpga-config : boolean, set if the FPGA has already been configured
prior to OS boot up. prior to OS boot up.
- encrypted-fpga-config : boolean, set if the bitstream is encrypted
- region-unfreeze-timeout-us : The maximum time in microseconds to wait for - region-unfreeze-timeout-us : The maximum time in microseconds to wait for
bridges to successfully become enabled after the region has been bridges to successfully become enabled after the region has been
programmed. programmed.
......
Lattice iCE40 FPGA Manager
Required properties:
- compatible: Should contain "lattice,ice40-fpga-mgr"
- reg: SPI chip select
- spi-max-frequency: Maximum SPI frequency (>=1000000, <=25000000)
- cdone-gpios: GPIO input connected to CDONE pin
- reset-gpios: Active-low GPIO output connected to CRESET_B pin. Note
that unless the GPIO is held low during startup, the
FPGA will enter Master SPI mode and drive SCK with a
clock signal potentially jamming other devices on the
bus until the firmware is loaded.
Example:
fpga: fpga@0 {
compatible = "lattice,ice40-fpga-mgr";
reg = <0>;
spi-max-frequency = <1000000>;
cdone-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
reset-gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
};
Xilinx Slave Serial SPI FPGA Manager
Xilinx Spartan-6 FPGAs support a method of loading the bitstream over
what is referred to as "slave serial" interface.
The slave serial link is not technically SPI, and might require extra
circuits in order to play nicely with other SPI slaves on the same bus.
See https://www.xilinx.com/support/documentation/user_guides/ug380.pdf
Required properties:
- compatible: should contain "xlnx,fpga-slave-serial"
- reg: spi chip select of the FPGA
- prog_b-gpios: config pin (referred to as PROGRAM_B in the manual)
- done-gpios: config status pin (referred to as DONE in the manual)
Example for full FPGA configuration:
fpga-region0 {
compatible = "fpga-region";
fpga-mgr = <&fpga_mgr_spi>;
#address-cells = <0x1>;
#size-cells = <0x1>;
};
spi1: spi@10680 {
compatible = "marvell,armada-xp-spi", "marvell,orion-spi";
pinctrl-0 = <&spi0_pins>;
pinctrl-names = "default";
#address-cells = <1>;
#size-cells = <0>;
cell-index = <1>;
interrupts = <92>;
clocks = <&coreclk 0>;
status = "okay";
fpga_mgr_spi: fpga-mgr@0 {
compatible = "xlnx,fpga-slave-serial";
spi-max-frequency = <60000000>;
spi-cpha;
reg = <0>;
done-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
prog_b-gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
};
};
Allwinner sunxi-sid Allwinner sunxi-sid
Required properties: Required properties:
- compatible: "allwinner,sun4i-a10-sid" or "allwinner,sun7i-a20-sid" - compatible: Should be one of the following:
"allwinner,sun4i-a10-sid"
"allwinner,sun7i-a20-sid"
"allwinner,sun8i-h3-sid"
- reg: Should contain registers location and length - reg: Should contain registers location and length
= Data cells = = Data cells =
......
Freescale i.MX IC Identification Module (IIM) device tree bindings
This binding represents the IC Identification Module (IIM) found on
i.MX25, i.MX27, i.MX31, i.MX35, i.MX51 and i.MX53 SoCs.
Required properties:
- compatible: should be one of
"fsl,imx25-iim", "fsl,imx27-iim",
"fsl,imx31-iim", "fsl,imx35-iim",
"fsl,imx51-iim", "fsl,imx53-iim",
- reg: Should contain the register base and length.
- interrupts: Should contain the interrupt for the IIM
- clocks: Should contain a phandle pointing to the gated peripheral clock.
Example:
iim: iim@63f98000 {
compatible = "fsl,imx53-iim", "fsl,imx27-iim";
reg = <0x63f98000 0x4000>;
interrupts = <69>;
clocks = <&clks IMX5_CLK_IIM_GATE>;
};
...@@ -9,14 +9,19 @@ Required properties: ...@@ -9,14 +9,19 @@ Required properties:
"fsl,imx6sl-ocotp" (i.MX6SL), or "fsl,imx6sl-ocotp" (i.MX6SL), or
"fsl,imx6sx-ocotp" (i.MX6SX), "fsl,imx6sx-ocotp" (i.MX6SX),
"fsl,imx6ul-ocotp" (i.MX6UL), "fsl,imx6ul-ocotp" (i.MX6UL),
"fsl,imx7d-ocotp" (i.MX7D/S),
followed by "syscon". followed by "syscon".
- reg: Should contain the register base and length. - reg: Should contain the register base and length.
- clocks: Should contain a phandle pointing to the gated peripheral clock. - clocks: Should contain a phandle pointing to the gated peripheral clock.
Optional properties:
- read-only: disable write access
Example: Example:
ocotp: ocotp@021bc000 { ocotp: ocotp@021bc000 {
compatible = "fsl,imx6q-ocotp", "syscon"; compatible = "fsl,imx6q-ocotp", "syscon";
reg = <0x021bc000 0x4000>; reg = <0x021bc000 0x4000>;
clocks = <&clks IMX6QDL_CLK_IIM>; clocks = <&clks IMX6QDL_CLK_IIM>;
read-only;
}; };
This diff is collapsed.
Staging/Android Switch Class Porting Guide
(linux/drivers/staging/android/switch)
(c) Copyright 2012 Samsung Electronics
AUTHORS
MyungJoo Ham <myungjoo.ham@samsung.com>
/*****************************************************************
* CHAPTER 1. *
* PORTING SWITCH CLASS DEVICE DRIVERS *
*****************************************************************/
****** STEP 1. Basic Functionality
No extcon extended feature, but switch features only.
- struct switch_dev (fed to switch_dev_register/unregister)
@name: no change
@dev: no change
@index: drop (not used in switch device driver side anyway)
@state: no change
If you have used @state with magic numbers, keep it
at this step.
@print_name: no change but type change (switch_dev->extcon_dev)
@print_state: no change but type change (switch_dev->extcon_dev)
- switch_dev_register(sdev, dev)
=> extcon_dev_register(edev)
: type change (sdev->edev)
: remove second param('dev'). if edev has parent device, should store
'dev' to 'edev.dev.parent' before registering extcon device
- switch_dev_unregister(sdev)
=> extcon_dev_unregister(edev)
: no change but type change (sdev->edev)
- switch_get_state(sdev)
=> extcon_get_state(edev)
: no change but type change (sdev->edev) and (return: int->u32)
- switch_set_state(sdev, state)
=> extcon_set_state(edev, state)
: no change but type change (sdev->edev) and (state: int->u32)
With this changes, the ex-switch extcon class device works as it once
worked as switch class device. However, it will now have additional
interfaces (both ABI and in-kernel API) and different ABI locations.
However, if CONFIG_ANDROID is enabled without CONFIG_ANDROID_SWITCH,
/sys/class/switch/* will be symbolically linked to /sys/class/extcon/
so that they are still compatible with legacy userspace processes.
****** STEP 2. Multistate (no more magic numbers in state value)
Extcon's extended features for switch device drivers with
complex features usually required magic numbers in state
value of switch_dev. With extcon, such magic numbers that
support multiple cables are no more required or supported.
1. Define cable names at edev->supported_cable.
2. (Recommended) remove print_state callback.
3. Use extcon_get_cable_state_(edev, index) or
extcon_get_cable_state(edev, cable_name) instead of
extcon_get_state(edev) if you intend to get a state of a specific
cable. Same for set_state. This way, you can remove the usage of
magic numbers in state value.
4. Use extcon_update_state() if you are updating specific bits of
the state value.
Example: a switch device driver w/ magic numbers for two cables.
"0x00": no cables connected.
"0x01": cable 1 connected
"0x02": cable 2 connected
"0x03": cable 1 and 2 connected
1. edev->supported_cable = {"1", "2", NULL};
2. edev->print_state = NULL;
3. extcon_get_cable_state_(edev, 0) shows cable 1's state.
extcon_get_cable_state(edev, "1") shows cable 1's state.
extcon_set_cable_state_(edev, 1) sets cable 2's state.
extcon_set_cable_state(edev, "2") sets cable 2's state
4. extcon_update_state(edev, 0x01, 0) sets the least bit's 0.
****** STEP 3. Notify other device drivers
You can notify others of the cable attach/detach events with
notifier chains.
At the side of other device drivers (the extcon device itself
does not need to get notified of its own events), there are two
methods to register notifier_block for cable events:
(a) for a specific cable or (b) for every cable.
(a) extcon_register_interest(obj, extcon_name, cable_name, nb)
Example: want to get news of "MAX8997_MUIC"'s "USB" cable
obj = kzalloc(sizeof(struct extcon_specific_cable_nb),
GFP_KERNEL);
nb->notifier_call = the_callback_to_handle_usb;
extcon_register_intereset(obj, "MAX8997_MUIC", "USB", nb);
(b) extcon_register_notifier(edev, nb)
Call nb for any changes in edev.
Please note that in order to properly behave with method (a),
the extcon device driver should support multistate feature (STEP 2).
****** STEP 4. Inter-cable relation (mutually exclusive)
You can provide inter-cable mutually exclusiveness information
for an extcon device. When cables A and B are declared to be mutually
exclusive, the two cables cannot be in ATTACHED state simulteneously.
/*****************************************************************
* CHAPTER 2. *
* PORTING USERSPACE w/ SWITCH CLASS DEVICE SUPPORT *
*****************************************************************/
****** ABI Location
If "CONFIG_ANDROID" is enabled, /sys/class/switch/* are created
as symbolic links to /sys/class/extcon/*.
The two files of switch class, name and state, are provided with
extcon, too. When the multistate support (STEP 2 of CHAPTER 1.) is
not enabled or print_state callback is supplied, the output of
state ABI is same with switch class.
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
- This file - This file
w1_therm w1_therm
- The Maxim/Dallas Semiconductor ds18*20 temperature sensor. - The Maxim/Dallas Semiconductor ds18*20 temperature sensor.
w1_ds2413
- The Maxim/Dallas Semiconductor ds2413 dual channel addressable switch.
w1_ds2423 w1_ds2423
- The Maxim/Dallas Semiconductor ds2423 counter device. - The Maxim/Dallas Semiconductor ds2423 counter device.
w1_ds2438
- The Maxim/Dallas Semiconductor ds2438 smart battery monitor.
w1_ds28e04 w1_ds28e04
- The Maxim/Dallas Semiconductor ds28e04 eeprom. - The Maxim/Dallas Semiconductor ds28e04 eeprom.
Kernel driver w1_ds2413
=======================
Supported chips:
* Maxim DS2413 1-Wire Dual Channel Addressable Switch
supported family codes:
W1_FAMILY_DS2413 0x3A
Author: Mariusz Bialonczyk <manio@skyboo.net>
Description
-----------
The DS2413 chip has two open-drain outputs (PIO A and PIO B).
Support is provided through the sysfs files "output" and "state".
Reading state
-------------
The "state" file provides one-byte value which is in the same format as for
the chip PIO_ACCESS_READ command (refer the datasheet for details):
Bit 0: PIOA Pin State
Bit 1: PIOA Output Latch State
Bit 2: PIOB Pin State
Bit 3: PIOB Output Latch State
Bit 4-7: Complement of Bit 3 to Bit 0 (verified by the kernel module)
This file is readonly.
Writing output
--------------
You can set the PIO pins using the "output" file.
It is writable, you can write one-byte value to this sysfs file.
Similarly the byte format is the same as for the PIO_ACCESS_WRITE command:
Bit 0: PIOA
Bit 1: PIOB
Bit 2-7: No matter (driver will set it to "1"s)
The chip has some kind of basic protection against transmission errors.
When reading the state, there is a four complement bits.
The driver is checking this complement, and when it is wrong then it is
returning I/O error.
When writing output, the master must repeat the PIO Output Data byte in
its inverted form and it is waiting for a confirmation.
If the write is unsuccessful for three times, the write also returns
I/O error.
Kernel driver w1_ds2438
=======================
Supported chips:
* Maxim DS2438 Smart Battery Monitor
supported family codes:
W1_FAMILY_DS2438 0x26
Author: Mariusz Bialonczyk <manio@skyboo.net>
Description
-----------
The DS2438 chip provides several functions that are desirable to carry in
a battery pack. It also has a 40 bytes of nonvolatile EEPROM.
Because the ability of temperature, current and voltage measurement, the chip
is also often used in weather stations and applications such as: rain gauge,
wind speed/direction measuring, humidity sensing, etc.
Current support is provided through the following sysfs files (all files
except "iad" are readonly):
"iad"
-----
This file controls the 'Current A/D Control Bit' (IAD) in the
Status/Configuration Register.
Writing a zero value will clear the IAD bit and disables the current
measurements.
Writing value "1" is setting the IAD bit (enables the measurements).
The IAD bit is enabled by default in the DS2438.
When writing to sysfs file bits 2-7 are ignored, so it's safe to write ASCII.
An I/O error is returned when there is a problem setting the new value.
"page0"
-------
This file provides full 8 bytes of the chip Page 0 (00h).
This page contains the most frequently accessed information of the DS2438.
Internally when this file is read, the additional CRC byte is also obtained
from the slave device. If it is correct, the 8 bytes page data are passed
to userspace, otherwise an I/O error is returned.
"temperature"
-------------
Opening and reading this file initiates the CONVERT_T (temperature conversion)
command of the chip, afterwards the temperature is read from the device
registers and provided as an ASCII decimal value.
Important: The returned value has to be divided by 256 to get a real
temperature in degrees Celsius.
"vad", "vdd"
------------
Opening and reading this file initiates the CONVERT_V (voltage conversion)
command of the chip.
Depending on a sysfs filename a different input for the A/D will be selected:
vad: general purpose A/D input (VAD)
vdd: battery input (VDD)
After the voltage conversion the value is returned as decimal ASCII.
Note: The value is in mV, so to get a volts the value has to be divided by 10.
...@@ -5161,7 +5161,6 @@ F: include/uapi/linux/firewire*.h ...@@ -5161,7 +5161,6 @@ F: include/uapi/linux/firewire*.h
F: tools/firewire/ F: tools/firewire/
FIRMWARE LOADER (request_firmware) FIRMWARE LOADER (request_firmware)
M: Ming Lei <ming.lei@canonical.com>
M: Luis R. Rodriguez <mcgrof@kernel.org> M: Luis R. Rodriguez <mcgrof@kernel.org>
L: linux-kernel@vger.kernel.org L: linux-kernel@vger.kernel.org
S: Maintained S: Maintained
...@@ -5191,13 +5190,15 @@ F: include/linux/ipmi-fru.h ...@@ -5191,13 +5190,15 @@ F: include/linux/ipmi-fru.h
K: fmc_d.*register K: fmc_d.*register
FPGA MANAGER FRAMEWORK FPGA MANAGER FRAMEWORK
M: Alan Tull <atull@opensource.altera.com> M: Alan Tull <atull@kernel.org>
R: Moritz Fischer <moritz.fischer@ettus.com> R: Moritz Fischer <moritz.fischer@ettus.com>
L: linux-fpga@vger.kernel.org L: linux-fpga@vger.kernel.org
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/atull/linux-fpga.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/atull/linux-fpga.git
F: Documentation/fpga/
F: Documentation/devicetree/bindings/fpga/
F: drivers/fpga/ F: drivers/fpga/
F: include/linux/fpga/fpga-mgr.h F: include/linux/fpga/
W: http://www.rocketboards.org W: http://www.rocketboards.org
FPU EMULATOR FPU EMULATOR
...@@ -9131,7 +9132,6 @@ F: drivers/nvme/target/fcloop.c ...@@ -9131,7 +9132,6 @@ F: drivers/nvme/target/fcloop.c
NVMEM FRAMEWORK NVMEM FRAMEWORK
M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> M: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
M: Maxime Ripard <maxime.ripard@free-electrons.com>
S: Maintained S: Maintained
F: drivers/nvmem/ F: drivers/nvmem/
F: Documentation/devicetree/bindings/nvmem/ F: Documentation/devicetree/bindings/nvmem/
......
...@@ -210,6 +210,28 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = { ...@@ -210,6 +210,28 @@ static struct ep93xx_eth_data __initdata ts72xx_eth_data = {
.phy_id = 1, .phy_id = 1,
}; };
#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
/* Relative to EP93XX_CS1_PHYS_BASE */
#define TS73XX_FPGA_LOADER_BASE 0x03c00000
static struct resource ts73xx_fpga_resources[] = {
{
.start = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE,
.end = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1,
.flags = IORESOURCE_MEM,
},
};
static struct platform_device ts73xx_fpga_device = {
.name = "ts73xx-fpga-mgr",
.id = -1,
.resource = ts73xx_fpga_resources,
.num_resources = ARRAY_SIZE(ts73xx_fpga_resources),
};
#endif
static void __init ts72xx_init_machine(void) static void __init ts72xx_init_machine(void)
{ {
ep93xx_init_devices(); ep93xx_init_devices();
...@@ -218,6 +240,10 @@ static void __init ts72xx_init_machine(void) ...@@ -218,6 +240,10 @@ static void __init ts72xx_init_machine(void)
platform_device_register(&ts72xx_wdt_device); platform_device_register(&ts72xx_wdt_device);
ep93xx_register_eth(&ts72xx_eth_data, 1); ep93xx_register_eth(&ts72xx_eth_data, 1);
#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX)
if (board_is_ts7300())
platform_device_register(&ts73xx_fpga_device);
#endif
} }
MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC")
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/clockchips.h> #include <linux/clockchips.h>
#include <linux/hyperv.h>
#ifdef CONFIG_HYPERV_TSCPAGE #ifdef CONFIG_HYPERV_TSCPAGE
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
* Recommend using hypercall for address space switches rather * Recommend using hypercall for address space switches rather
* than MOV to CR3 instruction * than MOV to CR3 instruction
*/ */
#define HV_X64_MWAIT_RECOMMENDED (1 << 0) #define HV_X64_AS_SWITCH_RECOMMENDED (1 << 0)
/* Recommend using hypercall for local TLB flushes rather /* Recommend using hypercall for local TLB flushes rather
* than INVLPG or MOV to CR3 instructions */ * than INVLPG or MOV to CR3 instructions */
#define HV_X64_LOCAL_TLB_FLUSH_RECOMMENDED (1 << 1) #define HV_X64_LOCAL_TLB_FLUSH_RECOMMENDED (1 << 1)
...@@ -147,6 +147,11 @@ ...@@ -147,6 +147,11 @@
*/ */
#define HV_X64_RELAXED_TIMING_RECOMMENDED (1 << 5) #define HV_X64_RELAXED_TIMING_RECOMMENDED (1 << 5)
/*
* Virtual APIC support
*/
#define HV_X64_DEPRECATING_AEOI_RECOMMENDED (1 << 9)
/* /*
* Crash notification flag. * Crash notification flag.
*/ */
......
...@@ -49,6 +49,9 @@ void hyperv_vector_handler(struct pt_regs *regs) ...@@ -49,6 +49,9 @@ void hyperv_vector_handler(struct pt_regs *regs)
if (vmbus_handler) if (vmbus_handler)
vmbus_handler(); vmbus_handler();
if (ms_hyperv.hints & HV_X64_DEPRECATING_AEOI_RECOMMENDED)
ack_APIC_irq();
exiting_irq(); exiting_irq();
set_irq_regs(old_regs); set_irq_regs(old_regs);
} }
......
...@@ -22,7 +22,7 @@ config ANDROID_BINDER_IPC ...@@ -22,7 +22,7 @@ config ANDROID_BINDER_IPC
config ANDROID_BINDER_DEVICES config ANDROID_BINDER_DEVICES
string "Android Binder devices" string "Android Binder devices"
depends on ANDROID_BINDER_IPC depends on ANDROID_BINDER_IPC
default "binder" default "binder,hwbinder"
---help--- ---help---
Default value for the binder.devices parameter. Default value for the binder.devices parameter.
......
This diff is collapsed.
...@@ -2,7 +2,11 @@ ...@@ -2,7 +2,11 @@
# Makefile for the kernel auxiliary displays device drivers. # Makefile for the kernel auxiliary displays device drivers.
# #
obj-$(CONFIG_CHARLCD) += charlcd.o
obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o
obj-$(CONFIG_KS0108) += ks0108.o obj-$(CONFIG_KS0108) += ks0108.o
obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o obj-$(CONFIG_CFAG12864B) += cfag12864b.o cfag12864bfb.o
obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o obj-$(CONFIG_IMG_ASCII_LCD) += img-ascii-lcd.o
obj-$(CONFIG_HD44780) += hd44780.o
obj-$(CONFIG_HT16K33) += ht16k33.o obj-$(CONFIG_HT16K33) += ht16k33.o
obj-$(CONFIG_PANEL) += panel.o
This diff is collapsed.
/*
* HD44780 Character LCD driver for Linux
*
* Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
* Copyright (C) 2016-2017 Glider bvba
*
* 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; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <misc/charlcd.h>
enum hd44780_pin {
/* Order does matter due to writing to GPIO array subsets! */
PIN_DATA0, /* Optional */
PIN_DATA1, /* Optional */
PIN_DATA2, /* Optional */
PIN_DATA3, /* Optional */
PIN_DATA4,
PIN_DATA5,
PIN_DATA6,
PIN_DATA7,
PIN_CTRL_RS,
PIN_CTRL_RW, /* Optional */
PIN_CTRL_E,
PIN_CTRL_BL, /* Optional */
PIN_NUM
};
struct hd44780 {
struct gpio_desc *pins[PIN_NUM];
};
static void hd44780_backlight(struct charlcd *lcd, int on)
{
struct hd44780 *hd = lcd->drvdata;
if (hd->pins[PIN_CTRL_BL])
gpiod_set_value_cansleep(hd->pins[PIN_CTRL_BL], on);
}
static void hd44780_strobe_gpio(struct hd44780 *hd)
{
/* Maintain the data during 20 us before the strobe */
udelay(20);
gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 1);
/* Maintain the strobe during 40 us */
udelay(40);
gpiod_set_value_cansleep(hd->pins[PIN_CTRL_E], 0);
}
/* write to an LCD panel register in 8 bit GPIO mode */
static void hd44780_write_gpio8(struct hd44780 *hd, u8 val, unsigned int rs)
{
int values[10]; /* for DATA[0-7], RS, RW */
unsigned int i, n;
for (i = 0; i < 8; i++)
values[PIN_DATA0 + i] = !!(val & BIT(i));
values[PIN_CTRL_RS] = rs;
n = 9;
if (hd->pins[PIN_CTRL_RW]) {
values[PIN_CTRL_RW] = 0;
n++;
}
/* Present the data to the port */
gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA0], values);
hd44780_strobe_gpio(hd);
}
/* write to an LCD panel register in 4 bit GPIO mode */
static void hd44780_write_gpio4(struct hd44780 *hd, u8 val, unsigned int rs)
{
int values[10]; /* for DATA[0-7], RS, RW, but DATA[0-3] is unused */
unsigned int i, n;
/* High nibble + RS, RW */
for (i = 4; i < 8; i++)
values[PIN_DATA0 + i] = !!(val & BIT(i));
values[PIN_CTRL_RS] = rs;
n = 5;
if (hd->pins[PIN_CTRL_RW]) {
values[PIN_CTRL_RW] = 0;
n++;
}
/* Present the data to the port */
gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
&values[PIN_DATA4]);
hd44780_strobe_gpio(hd);
/* Low nibble */
for (i = 0; i < 4; i++)
values[PIN_DATA4 + i] = !!(val & BIT(i));
/* Present the data to the port */
gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
&values[PIN_DATA4]);
hd44780_strobe_gpio(hd);
}
/* Send a command to the LCD panel in 8 bit GPIO mode */
static void hd44780_write_cmd_gpio8(struct charlcd *lcd, int cmd)
{
struct hd44780 *hd = lcd->drvdata;
hd44780_write_gpio8(hd, cmd, 0);
/* The shortest command takes at least 120 us */
udelay(120);
}
/* Send data to the LCD panel in 8 bit GPIO mode */
static void hd44780_write_data_gpio8(struct charlcd *lcd, int data)
{
struct hd44780 *hd = lcd->drvdata;
hd44780_write_gpio8(hd, data, 1);
/* The shortest data takes at least 45 us */
udelay(45);
}
static const struct charlcd_ops hd44780_ops_gpio8 = {
.write_cmd = hd44780_write_cmd_gpio8,
.write_data = hd44780_write_data_gpio8,
.backlight = hd44780_backlight,
};
/* Send a command to the LCD panel in 4 bit GPIO mode */
static void hd44780_write_cmd_gpio4(struct charlcd *lcd, int cmd)
{
struct hd44780 *hd = lcd->drvdata;
hd44780_write_gpio4(hd, cmd, 0);
/* The shortest command takes at least 120 us */
udelay(120);
}
/* Send 4-bits of a command to the LCD panel in raw 4 bit GPIO mode */
static void hd44780_write_cmd_raw_gpio4(struct charlcd *lcd, int cmd)
{
int values[10]; /* for DATA[0-7], RS, RW, but DATA[0-3] is unused */
struct hd44780 *hd = lcd->drvdata;
unsigned int i, n;
/* Command nibble + RS, RW */
for (i = 0; i < 4; i++)
values[PIN_DATA4 + i] = !!(cmd & BIT(i));
values[PIN_CTRL_RS] = 0;
n = 5;
if (hd->pins[PIN_CTRL_RW]) {
values[PIN_CTRL_RW] = 0;
n++;
}
/* Present the data to the port */
gpiod_set_array_value_cansleep(n, &hd->pins[PIN_DATA4],
&values[PIN_DATA4]);
hd44780_strobe_gpio(hd);
}
/* Send data to the LCD panel in 4 bit GPIO mode */
static void hd44780_write_data_gpio4(struct charlcd *lcd, int data)
{
struct hd44780 *hd = lcd->drvdata;
hd44780_write_gpio4(hd, data, 1);
/* The shortest data takes at least 45 us */
udelay(45);
}
static const struct charlcd_ops hd44780_ops_gpio4 = {
.write_cmd = hd44780_write_cmd_gpio4,
.write_cmd_raw4 = hd44780_write_cmd_raw_gpio4,
.write_data = hd44780_write_data_gpio4,
.backlight = hd44780_backlight,
};
static int hd44780_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
unsigned int i, base;
struct charlcd *lcd;
struct hd44780 *hd;
int ifwidth, ret;
/* Required pins */
ifwidth = gpiod_count(dev, "data");
if (ifwidth < 0)
return ifwidth;
switch (ifwidth) {
case 4:
base = PIN_DATA4;
break;
case 8:
base = PIN_DATA0;
break;
default:
return -EINVAL;
}
lcd = charlcd_alloc(sizeof(struct hd44780));
if (!lcd)
return -ENOMEM;
hd = lcd->drvdata;
for (i = 0; i < ifwidth; i++) {
hd->pins[base + i] = devm_gpiod_get_index(dev, "data", i,
GPIOD_OUT_LOW);
if (IS_ERR(hd->pins[base + i])) {
ret = PTR_ERR(hd->pins[base + i]);
goto fail;
}
}
hd->pins[PIN_CTRL_E] = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(hd->pins[PIN_CTRL_E])) {
ret = PTR_ERR(hd->pins[PIN_CTRL_E]);
goto fail;
}
hd->pins[PIN_CTRL_RS] = devm_gpiod_get(dev, "rs", GPIOD_OUT_HIGH);
if (IS_ERR(hd->pins[PIN_CTRL_RS])) {
ret = PTR_ERR(hd->pins[PIN_CTRL_RS]);
goto fail;
}
/* Optional pins */
hd->pins[PIN_CTRL_RW] = devm_gpiod_get_optional(dev, "rw",
GPIOD_OUT_LOW);
if (IS_ERR(hd->pins[PIN_CTRL_RW])) {
ret = PTR_ERR(hd->pins[PIN_CTRL_RW]);
goto fail;
}
hd->pins[PIN_CTRL_BL] = devm_gpiod_get_optional(dev, "backlight",
GPIOD_OUT_LOW);
if (IS_ERR(hd->pins[PIN_CTRL_BL])) {
ret = PTR_ERR(hd->pins[PIN_CTRL_BL]);
goto fail;
}
/* Required properties */
ret = device_property_read_u32(dev, "display-height-chars",
&lcd->height);
if (ret)
goto fail;
ret = device_property_read_u32(dev, "display-width-chars", &lcd->width);
if (ret)
goto fail;
/*
* On displays with more than two rows, the internal buffer width is
* usually equal to the display width
*/
if (lcd->height > 2)
lcd->bwidth = lcd->width;
/* Optional properties */
device_property_read_u32(dev, "internal-buffer-width", &lcd->bwidth);
lcd->ifwidth = ifwidth;
lcd->ops = ifwidth == 8 ? &hd44780_ops_gpio8 : &hd44780_ops_gpio4;
ret = charlcd_register(lcd);
if (ret)
goto fail;
platform_set_drvdata(pdev, lcd);
return 0;
fail:
kfree(lcd);
return ret;
}
static int hd44780_remove(struct platform_device *pdev)
{
struct charlcd *lcd = platform_get_drvdata(pdev);
charlcd_unregister(lcd);
return 0;
}
static const struct of_device_id hd44780_of_match[] = {
{ .compatible = "hit,hd44780" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, hd44780_of_match);
static struct platform_driver hd44780_driver = {
.probe = hd44780_probe,
.remove = hd44780_remove,
.driver = {
.name = "hd44780",
.of_match_table = hd44780_of_match,
},
};
module_platform_driver(hd44780_driver);
MODULE_DESCRIPTION("HD44780 Character LCD driver");
MODULE_AUTHOR("Geert Uytterhoeven <geert@linux-m68k.org>");
MODULE_LICENSE("GPL");
...@@ -254,18 +254,22 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad *keypad) ...@@ -254,18 +254,22 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad *keypad)
{ {
const unsigned short *keycodes = keypad->dev->keycode; const unsigned short *keycodes = keypad->dev->keycode;
u16 new_state[HT16K33_MATRIX_KEYPAD_MAX_COLS]; u16 new_state[HT16K33_MATRIX_KEYPAD_MAX_COLS];
u8 data[HT16K33_MATRIX_KEYPAD_MAX_COLS * 2]; __le16 data[HT16K33_MATRIX_KEYPAD_MAX_COLS];
unsigned long bits_changed; unsigned long bits_changed;
int row, col, code; int row, col, code;
int rc;
bool pressed = false; bool pressed = false;
if (i2c_smbus_read_i2c_block_data(keypad->client, 0x40, 6, data) != 6) { rc = i2c_smbus_read_i2c_block_data(keypad->client, 0x40,
dev_err(&keypad->client->dev, "Failed to read key data\n"); sizeof(data), (u8 *)data);
if (rc != sizeof(data)) {
dev_err(&keypad->client->dev,
"Failed to read key data, rc=%d\n", rc);
return false; return false;
} }
for (col = 0; col < keypad->cols; col++) { for (col = 0; col < keypad->cols; col++) {
new_state[col] = (data[col * 2 + 1] << 8) | data[col * 2]; new_state[col] = le16_to_cpu(data[col]);
if (new_state[col]) if (new_state[col])
pressed = true; pressed = true;
bits_changed = keypad->last_key_state[col] ^ new_state[col]; bits_changed = keypad->last_key_state[col] ^ new_state[col];
...@@ -278,7 +282,7 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad *keypad) ...@@ -278,7 +282,7 @@ static bool ht16k33_keypad_scan(struct ht16k33_keypad *keypad)
} }
} }
input_sync(keypad->dev); input_sync(keypad->dev);
memcpy(keypad->last_key_state, new_state, sizeof(new_state)); memcpy(keypad->last_key_state, new_state, sizeof(u16) * keypad->cols);
return pressed; return pressed;
} }
...@@ -353,6 +357,12 @@ static int ht16k33_keypad_probe(struct i2c_client *client, ...@@ -353,6 +357,12 @@ static int ht16k33_keypad_probe(struct i2c_client *client,
err = matrix_keypad_parse_of_params(&client->dev, &rows, &cols); err = matrix_keypad_parse_of_params(&client->dev, &rows, &cols);
if (err) if (err)
return err; return err;
if (rows > HT16K33_MATRIX_KEYPAD_MAX_ROWS ||
cols > HT16K33_MATRIX_KEYPAD_MAX_COLS) {
dev_err(&client->dev, "%u rows or %u cols out of range in DT\n",
rows, cols);
return -ERANGE;
}
keypad->rows = rows; keypad->rows = rows;
keypad->cols = cols; keypad->cols = cols;
......
...@@ -220,6 +220,7 @@ static const struct of_device_id img_ascii_lcd_matches[] = { ...@@ -220,6 +220,7 @@ static const struct of_device_id img_ascii_lcd_matches[] = {
{ .compatible = "mti,sead3-lcd", .data = &sead3_config }, { .compatible = "mti,sead3-lcd", .data = &sead3_config },
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(of, img_ascii_lcd_matches);
/** /**
* img_ascii_lcd_scroll() - scroll the display by a character * img_ascii_lcd_scroll() - scroll the display by a character
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* timer and 180 seconds for the margin of error. IOW, a timer is set * timer and 180 seconds for the margin of error. IOW, a timer is set
* for 60 seconds. When the timer fires, the callback checks the * for 60 seconds. When the timer fires, the callback checks the
* actual duration that the timer waited. If the duration exceeds the * actual duration that the timer waited. If the duration exceeds the
* alloted time and margin (here 60 + 180, or 240 seconds), the machine * allotted time and margin (here 60 + 180, or 240 seconds), the machine
* is restarted. A healthy machine will have the duration match the * is restarted. A healthy machine will have the duration match the
* expected timeout very closely. * expected timeout very closely.
*/ */
......
...@@ -575,7 +575,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets, ...@@ -575,7 +575,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
} }
static int static int
hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg,
struct hpet_info *info) struct hpet_info *info)
{ {
struct hpet_timer __iomem *timer; struct hpet_timer __iomem *timer;
......
...@@ -109,7 +109,7 @@ static const struct file_operations misc_proc_fops = { ...@@ -109,7 +109,7 @@ static const struct file_operations misc_proc_fops = {
}; };
#endif #endif
static int misc_open(struct inode * inode, struct file * file) static int misc_open(struct inode *inode, struct file *file)
{ {
int minor = iminor(inode); int minor = iminor(inode);
struct miscdevice *c; struct miscdevice *c;
...@@ -150,7 +150,7 @@ static int misc_open(struct inode * inode, struct file * file) ...@@ -150,7 +150,7 @@ static int misc_open(struct inode * inode, struct file * file)
err = 0; err = 0;
replace_fops(file, new_fops); replace_fops(file, new_fops);
if (file->f_op->open) if (file->f_op->open)
err = file->f_op->open(inode,file); err = file->f_op->open(inode, file);
fail: fail:
mutex_unlock(&misc_mtx); mutex_unlock(&misc_mtx);
return err; return err;
...@@ -182,7 +182,7 @@ static const struct file_operations misc_fops = { ...@@ -182,7 +182,7 @@ static const struct file_operations misc_fops = {
* failure. * failure.
*/ */
int misc_register(struct miscdevice * misc) int misc_register(struct miscdevice *misc)
{ {
dev_t dev; dev_t dev;
int err = 0; int err = 0;
...@@ -194,6 +194,7 @@ int misc_register(struct miscdevice * misc) ...@@ -194,6 +194,7 @@ int misc_register(struct miscdevice * misc)
if (is_dynamic) { if (is_dynamic) {
int i = find_first_zero_bit(misc_minors, DYNAMIC_MINORS); int i = find_first_zero_bit(misc_minors, DYNAMIC_MINORS);
if (i >= DYNAMIC_MINORS) { if (i >= DYNAMIC_MINORS) {
err = -EBUSY; err = -EBUSY;
goto out; goto out;
...@@ -287,13 +288,13 @@ static int __init misc_init(void) ...@@ -287,13 +288,13 @@ static int __init misc_init(void)
goto fail_remove; goto fail_remove;
err = -EIO; err = -EIO;
if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) if (register_chrdev(MISC_MAJOR, "misc", &misc_fops))
goto fail_printk; goto fail_printk;
misc_class->devnode = misc_devnode; misc_class->devnode = misc_devnode;
return 0; return 0;
fail_printk: fail_printk:
printk("unable to get major %d for misc devices\n", MISC_MAJOR); pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
class_destroy(misc_class); class_destroy(misc_class);
fail_remove: fail_remove:
if (ret) if (ret)
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/numa.h> #include <linux/numa.h>
#include <linux/refcount.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <linux/atomic.h> #include <linux/atomic.h>
...@@ -89,7 +90,7 @@ static int is_sn2; ...@@ -89,7 +90,7 @@ static int is_sn2;
* protect in fork case where multiple tasks share the vma_data. * protect in fork case where multiple tasks share the vma_data.
*/ */
struct vma_data { struct vma_data {
atomic_t refcnt; /* Number of vmas sharing the data. */ refcount_t refcnt; /* Number of vmas sharing the data. */
spinlock_t lock; /* Serialize access to this structure. */ spinlock_t lock; /* Serialize access to this structure. */
int count; /* Number of pages allocated. */ int count; /* Number of pages allocated. */
enum mspec_page_type type; /* Type of pages allocated. */ enum mspec_page_type type; /* Type of pages allocated. */
...@@ -144,7 +145,7 @@ mspec_open(struct vm_area_struct *vma) ...@@ -144,7 +145,7 @@ mspec_open(struct vm_area_struct *vma)
struct vma_data *vdata; struct vma_data *vdata;
vdata = vma->vm_private_data; vdata = vma->vm_private_data;
atomic_inc(&vdata->refcnt); refcount_inc(&vdata->refcnt);
} }
/* /*
...@@ -162,7 +163,7 @@ mspec_close(struct vm_area_struct *vma) ...@@ -162,7 +163,7 @@ mspec_close(struct vm_area_struct *vma)
vdata = vma->vm_private_data; vdata = vma->vm_private_data;
if (!atomic_dec_and_test(&vdata->refcnt)) if (!refcount_dec_and_test(&vdata->refcnt))
return; return;
last_index = (vdata->vm_end - vdata->vm_start) >> PAGE_SHIFT; last_index = (vdata->vm_end - vdata->vm_start) >> PAGE_SHIFT;
...@@ -274,7 +275,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, ...@@ -274,7 +275,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
vdata->vm_end = vma->vm_end; vdata->vm_end = vma->vm_end;
vdata->type = type; vdata->type = type;
spin_lock_init(&vdata->lock); spin_lock_init(&vdata->lock);
atomic_set(&vdata->refcnt, 1); refcount_set(&vdata->refcnt, 1);
vma->vm_private_data = vdata; vma->vm_private_data = vdata;
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP;
......
...@@ -218,8 +218,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev, ...@@ -218,8 +218,6 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev,
cdev_init(&chip->cdevs, &tpmrm_fops); cdev_init(&chip->cdevs, &tpmrm_fops);
chip->cdev.owner = THIS_MODULE; chip->cdev.owner = THIS_MODULE;
chip->cdevs.owner = THIS_MODULE; chip->cdevs.owner = THIS_MODULE;
chip->cdev.kobj.parent = &chip->dev.kobj;
chip->cdevs.kobj.parent = &chip->devs.kobj;
chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!chip->work_space.context_buf) { if (!chip->work_space.context_buf) {
...@@ -275,45 +273,24 @@ static int tpm_add_char_device(struct tpm_chip *chip) ...@@ -275,45 +273,24 @@ static int tpm_add_char_device(struct tpm_chip *chip)
{ {
int rc; int rc;
rc = cdev_add(&chip->cdev, chip->dev.devt, 1); rc = cdev_device_add(&chip->cdev, &chip->dev);
if (rc) { if (rc) {
dev_err(&chip->dev, dev_err(&chip->dev,
"unable to cdev_add() %s, major %d, minor %d, err=%d\n", "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
dev_name(&chip->dev), MAJOR(chip->dev.devt), dev_name(&chip->dev), MAJOR(chip->dev.devt),
MINOR(chip->dev.devt), rc); MINOR(chip->dev.devt), rc);
return rc; return rc;
} }
rc = device_add(&chip->dev); if (chip->flags & TPM_CHIP_FLAG_TPM2) {
if (rc) { rc = cdev_device_add(&chip->cdevs, &chip->devs);
dev_err(&chip->dev, if (rc) {
"unable to device_register() %s, major %d, minor %d, err=%d\n", dev_err(&chip->devs,
dev_name(&chip->dev), MAJOR(chip->dev.devt), "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n",
MINOR(chip->dev.devt), rc); dev_name(&chip->devs), MAJOR(chip->devs.devt),
MINOR(chip->devs.devt), rc);
cdev_del(&chip->cdev); return rc;
return rc; }
}
if (chip->flags & TPM_CHIP_FLAG_TPM2)
rc = cdev_add(&chip->cdevs, chip->devs.devt, 1);
if (rc) {
dev_err(&chip->dev,
"unable to cdev_add() %s, major %d, minor %d, err=%d\n",
dev_name(&chip->devs), MAJOR(chip->devs.devt),
MINOR(chip->devs.devt), rc);
return rc;
}
if (chip->flags & TPM_CHIP_FLAG_TPM2)
rc = device_add(&chip->devs);
if (rc) {
dev_err(&chip->dev,
"unable to device_register() %s, major %d, minor %d, err=%d\n",
dev_name(&chip->devs), MAJOR(chip->devs.devt),
MINOR(chip->devs.devt), rc);
cdev_del(&chip->cdevs);
return rc;
} }
/* Make the chip available. */ /* Make the chip available. */
...@@ -326,8 +303,7 @@ static int tpm_add_char_device(struct tpm_chip *chip) ...@@ -326,8 +303,7 @@ static int tpm_add_char_device(struct tpm_chip *chip)
static void tpm_del_char_device(struct tpm_chip *chip) static void tpm_del_char_device(struct tpm_chip *chip)
{ {
cdev_del(&chip->cdev); cdev_device_del(&chip->cdev, &chip->dev);
device_del(&chip->dev);
/* Make the chip unavailable. */ /* Make the chip unavailable. */
mutex_lock(&idr_lock); mutex_lock(&idr_lock);
...@@ -449,10 +425,8 @@ void tpm_chip_unregister(struct tpm_chip *chip) ...@@ -449,10 +425,8 @@ void tpm_chip_unregister(struct tpm_chip *chip)
{ {
tpm_del_legacy_sysfs(chip); tpm_del_legacy_sysfs(chip);
tpm_bios_log_teardown(chip); tpm_bios_log_teardown(chip);
if (chip->flags & TPM_CHIP_FLAG_TPM2) { if (chip->flags & TPM_CHIP_FLAG_TPM2)
cdev_del(&chip->cdevs); cdev_device_del(&chip->cdevs, &chip->devs);
device_del(&chip->devs);
}
tpm_del_char_device(chip); tpm_del_char_device(chip);
} }
EXPORT_SYMBOL_GPL(tpm_chip_unregister); EXPORT_SYMBOL_GPL(tpm_chip_unregister);
...@@ -2304,7 +2304,7 @@ static int __init init(void) ...@@ -2304,7 +2304,7 @@ static int __init init(void)
pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL); pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
if (!pdrvdata.debugfs_dir) if (!pdrvdata.debugfs_dir)
pr_warning("Error creating debugfs dir for virtio-ports\n"); pr_warn("Error creating debugfs dir for virtio-ports\n");
INIT_LIST_HEAD(&pdrvdata.consoles); INIT_LIST_HEAD(&pdrvdata.consoles);
INIT_LIST_HEAD(&pdrvdata.portdevs); INIT_LIST_HEAD(&pdrvdata.portdevs);
......
...@@ -703,13 +703,8 @@ static void dax_dev_release(struct device *dev) ...@@ -703,13 +703,8 @@ static void dax_dev_release(struct device *dev)
kfree(dax_dev); kfree(dax_dev);
} }
static void unregister_dax_dev(void *dev) static void kill_dax_dev(struct dax_dev *dax_dev)
{ {
struct dax_dev *dax_dev = to_dax_dev(dev);
struct cdev *cdev = &dax_dev->cdev;
dev_dbg(dev, "%s\n", __func__);
/* /*
* Note, rcu is not protecting the liveness of dax_dev, rcu is * Note, rcu is not protecting the liveness of dax_dev, rcu is
* ensuring that any fault handlers that might have seen * ensuring that any fault handlers that might have seen
...@@ -720,8 +715,17 @@ static void unregister_dax_dev(void *dev) ...@@ -720,8 +715,17 @@ static void unregister_dax_dev(void *dev)
dax_dev->alive = false; dax_dev->alive = false;
synchronize_srcu(&dax_srcu); synchronize_srcu(&dax_srcu);
unmap_mapping_range(dax_dev->inode->i_mapping, 0, 0, 1); unmap_mapping_range(dax_dev->inode->i_mapping, 0, 0, 1);
cdev_del(cdev); }
device_unregister(dev);
static void unregister_dax_dev(void *dev)
{
struct dax_dev *dax_dev = to_dax_dev(dev);
dev_dbg(dev, "%s\n", __func__);
kill_dax_dev(dax_dev);
cdev_device_del(&dax_dev->cdev, dev);
put_device(dev);
} }
struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
...@@ -772,18 +776,13 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, ...@@ -772,18 +776,13 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
goto err_inode; goto err_inode;
} }
/* device_initialize() so cdev can reference kobj parent */ /* from here on we're committed to teardown via dax_dev_release() */
device_initialize(dev); device_initialize(dev);
cdev = &dax_dev->cdev; cdev = &dax_dev->cdev;
cdev_init(cdev, &dax_fops); cdev_init(cdev, &dax_fops);
cdev->owner = parent->driver->owner; cdev->owner = parent->driver->owner;
cdev->kobj.parent = &dev->kobj;
rc = cdev_add(&dax_dev->cdev, dev_t, 1);
if (rc)
goto err_cdev;
/* from here on we're committed to teardown via dax_dev_release() */
dax_dev->num_resources = count; dax_dev->num_resources = count;
dax_dev->alive = true; dax_dev->alive = true;
dax_dev->region = dax_region; dax_dev->region = dax_region;
...@@ -795,8 +794,10 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, ...@@ -795,8 +794,10 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
dev->groups = dax_attribute_groups; dev->groups = dax_attribute_groups;
dev->release = dax_dev_release; dev->release = dax_dev_release;
dev_set_name(dev, "dax%d.%d", dax_region->id, dax_dev->id); dev_set_name(dev, "dax%d.%d", dax_region->id, dax_dev->id);
rc = device_add(dev);
rc = cdev_device_add(cdev, dev);
if (rc) { if (rc) {
kill_dax_dev(dax_dev);
put_device(dev); put_device(dev);
return ERR_PTR(rc); return ERR_PTR(rc);
} }
...@@ -807,8 +808,6 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, ...@@ -807,8 +808,6 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
return dax_dev; return dax_dev;
err_cdev:
iput(dax_dev->inode);
err_inode: err_inode:
ida_simple_remove(&dax_minor_ida, minor); ida_simple_remove(&dax_minor_ida, minor);
err_minor: err_minor:
......
...@@ -52,6 +52,13 @@ config EXTCON_INTEL_INT3496 ...@@ -52,6 +52,13 @@ config EXTCON_INTEL_INT3496
This ACPI device is typically found on Intel Baytrail or Cherrytrail This ACPI device is typically found on Intel Baytrail or Cherrytrail
based tablets, or other Baytrail / Cherrytrail devices. based tablets, or other Baytrail / Cherrytrail devices.
config EXTCON_INTEL_CHT_WC
tristate "Intel Cherrytrail Whiskey Cove PMIC extcon driver"
depends on INTEL_SOC_PMIC_CHTWC
help
Say Y here to enable extcon support for charger detection / control
on the Intel Cherrytrail Whiskey Cove PMIC.
config EXTCON_MAX14577 config EXTCON_MAX14577
tristate "Maxim MAX14577/77836 EXTCON Support" tristate "Maxim MAX14577/77836 EXTCON Support"
depends on MFD_MAX14577 depends on MFD_MAX14577
......
...@@ -9,6 +9,7 @@ obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o ...@@ -9,6 +9,7 @@ obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o
obj-$(CONFIG_EXTCON_AXP288) += extcon-axp288.o obj-$(CONFIG_EXTCON_AXP288) += extcon-axp288.o
obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o
obj-$(CONFIG_EXTCON_INTEL_INT3496) += extcon-intel-int3496.o obj-$(CONFIG_EXTCON_INTEL_INT3496) += extcon-intel-int3496.o
obj-$(CONFIG_EXTCON_INTEL_CHT_WC) += extcon-intel-cht-wc.o
obj-$(CONFIG_EXTCON_MAX14577) += extcon-max14577.o obj-$(CONFIG_EXTCON_MAX14577) += extcon-max14577.o
obj-$(CONFIG_EXTCON_MAX3355) += extcon-max3355.o obj-$(CONFIG_EXTCON_MAX3355) += extcon-max3355.o
obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o
......
...@@ -51,6 +51,9 @@ ...@@ -51,6 +51,9 @@
#define HPDET_DEBOUNCE 500 #define HPDET_DEBOUNCE 500
#define DEFAULT_MICD_TIMEOUT 2000 #define DEFAULT_MICD_TIMEOUT 2000
#define ARIZONA_HPDET_WAIT_COUNT 15
#define ARIZONA_HPDET_WAIT_DELAY_MS 20
#define QUICK_HEADPHONE_MAX_OHM 3 #define QUICK_HEADPHONE_MAX_OHM 3
#define MICROPHONE_MIN_OHM 1257 #define MICROPHONE_MIN_OHM 1257
#define MICROPHONE_MAX_OHM 30000 #define MICROPHONE_MAX_OHM 30000
...@@ -1049,6 +1052,40 @@ static void arizona_hpdet_work(struct work_struct *work) ...@@ -1049,6 +1052,40 @@ static void arizona_hpdet_work(struct work_struct *work)
mutex_unlock(&info->lock); mutex_unlock(&info->lock);
} }
static int arizona_hpdet_wait(struct arizona_extcon_info *info)
{
struct arizona *arizona = info->arizona;
unsigned int val;
int i, ret;
for (i = 0; i < ARIZONA_HPDET_WAIT_COUNT; i++) {
ret = regmap_read(arizona->regmap, ARIZONA_HEADPHONE_DETECT_2,
&val);
if (ret) {
dev_err(arizona->dev,
"Failed to read HPDET state: %d\n", ret);
return ret;
}
switch (info->hpdet_ip_version) {
case 0:
if (val & ARIZONA_HP_DONE)
return 0;
break;
default:
if (val & ARIZONA_HP_DONE_B)
return 0;
break;
}
msleep(ARIZONA_HPDET_WAIT_DELAY_MS);
}
dev_warn(arizona->dev, "HPDET did not appear to complete\n");
return -ETIMEDOUT;
}
static irqreturn_t arizona_jackdet(int irq, void *data) static irqreturn_t arizona_jackdet(int irq, void *data)
{ {
struct arizona_extcon_info *info = data; struct arizona_extcon_info *info = data;
...@@ -1155,6 +1192,15 @@ static irqreturn_t arizona_jackdet(int irq, void *data) ...@@ -1155,6 +1192,15 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
"Removal report failed: %d\n", ret); "Removal report failed: %d\n", ret);
} }
/*
* If the jack was removed during a headphone detection we
* need to wait for the headphone detection to finish, as
* it can not be aborted. We don't want to be able to start
* a new headphone detection from a fresh insert until this
* one is finished.
*/
arizona_hpdet_wait(info);
regmap_update_bits(arizona->regmap, regmap_update_bits(arizona->regmap,
ARIZONA_JACK_DETECT_DEBOUNCE, ARIZONA_JACK_DETECT_DEBOUNCE,
ARIZONA_MICD_CLAMP_DB | ARIZONA_JD1_DB, ARIZONA_MICD_CLAMP_DB | ARIZONA_JD1_DB,
......
This diff is collapsed.
...@@ -413,6 +413,12 @@ static int palmas_usb_resume(struct device *dev) ...@@ -413,6 +413,12 @@ static int palmas_usb_resume(struct device *dev)
if (palmas_usb->enable_gpio_id_detection) if (palmas_usb->enable_gpio_id_detection)
disable_irq_wake(palmas_usb->gpio_id_irq); disable_irq_wake(palmas_usb->gpio_id_irq);
} }
/* check if GPIO states changed while suspend/resume */
if (palmas_usb->enable_gpio_vbus_detection)
palmas_vbus_irq_handler(palmas_usb->gpio_vbus_irq, palmas_usb);
palmas_gpio_id_detect(&palmas_usb->wq_detectid.work);
return 0; return 0;
}; };
#endif #endif
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/acpi.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#define USB_GPIO_DEBOUNCE_MS 20 /* ms */ #define USB_GPIO_DEBOUNCE_MS 20 /* ms */
...@@ -111,7 +110,7 @@ static int usb_extcon_probe(struct platform_device *pdev) ...@@ -111,7 +110,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
struct usb_extcon_info *info; struct usb_extcon_info *info;
int ret; int ret;
if (!np && !ACPI_HANDLE(dev)) if (!np)
return -EINVAL; return -EINVAL;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
...@@ -195,7 +194,7 @@ static int usb_extcon_probe(struct platform_device *pdev) ...@@ -195,7 +194,7 @@ static int usb_extcon_probe(struct platform_device *pdev)
} }
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
device_init_wakeup(dev, true); device_set_wakeup_capable(&pdev->dev, true);
/* Perform initial detection */ /* Perform initial detection */
usb_extcon_detect_cable(&info->wq_detcable.work); usb_extcon_detect_cable(&info->wq_detcable.work);
...@@ -282,9 +281,8 @@ static int usb_extcon_resume(struct device *dev) ...@@ -282,9 +281,8 @@ static int usb_extcon_resume(struct device *dev)
if (info->vbus_gpiod) if (info->vbus_gpiod)
enable_irq(info->vbus_irq); enable_irq(info->vbus_irq);
if (!device_may_wakeup(dev)) queue_delayed_work(system_power_efficient_wq,
queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, 0);
&info->wq_detcable, 0);
return ret; return ret;
} }
......
...@@ -230,9 +230,6 @@ struct extcon_cable { ...@@ -230,9 +230,6 @@ struct extcon_cable {
}; };
static struct class *extcon_class; static struct class *extcon_class;
#if defined(CONFIG_ANDROID)
static struct class_compat *switch_class;
#endif /* CONFIG_ANDROID */
static LIST_HEAD(extcon_dev_list); static LIST_HEAD(extcon_dev_list);
static DEFINE_MUTEX(extcon_dev_list_lock); static DEFINE_MUTEX(extcon_dev_list_lock);
...@@ -380,7 +377,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr, ...@@ -380,7 +377,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
for (i = 0; i < edev->max_supported; i++) { for (i = 0; i < edev->max_supported; i++) {
count += sprintf(buf + count, "%s=%d\n", count += sprintf(buf + count, "%s=%d\n",
extcon_info[edev->supported_cable[i]].name, extcon_info[edev->supported_cable[i]].name,
!!(edev->state & (1 << i))); !!(edev->state & BIT(i)));
} }
return count; return count;
...@@ -1032,12 +1029,6 @@ static int create_extcon_class(void) ...@@ -1032,12 +1029,6 @@ static int create_extcon_class(void)
if (IS_ERR(extcon_class)) if (IS_ERR(extcon_class))
return PTR_ERR(extcon_class); return PTR_ERR(extcon_class);
extcon_class->dev_groups = extcon_groups; extcon_class->dev_groups = extcon_groups;
#if defined(CONFIG_ANDROID)
switch_class = class_compat_register("switch");
if (WARN(!switch_class, "cannot allocate"))
return -ENOMEM;
#endif /* CONFIG_ANDROID */
} }
return 0; return 0;
...@@ -1259,10 +1250,6 @@ int extcon_dev_register(struct extcon_dev *edev) ...@@ -1259,10 +1250,6 @@ int extcon_dev_register(struct extcon_dev *edev)
put_device(&edev->dev); put_device(&edev->dev);
goto err_dev; goto err_dev;
} }
#if defined(CONFIG_ANDROID)
if (switch_class)
ret = class_compat_create_link(switch_class, &edev->dev, NULL);
#endif /* CONFIG_ANDROID */
spin_lock_init(&edev->lock); spin_lock_init(&edev->lock);
...@@ -1350,10 +1337,6 @@ void extcon_dev_unregister(struct extcon_dev *edev) ...@@ -1350,10 +1337,6 @@ void extcon_dev_unregister(struct extcon_dev *edev)
kfree(edev->cables); kfree(edev->cables);
} }
#if defined(CONFIG_ANDROID)
if (switch_class)
class_compat_remove_link(switch_class, &edev->dev, NULL);
#endif
put_device(&edev->dev); put_device(&edev->dev);
} }
EXPORT_SYMBOL_GPL(extcon_dev_unregister); EXPORT_SYMBOL_GPL(extcon_dev_unregister);
...@@ -1424,9 +1407,6 @@ module_init(extcon_class_init); ...@@ -1424,9 +1407,6 @@ module_init(extcon_class_init);
static void __exit extcon_class_exit(void) static void __exit extcon_class_exit(void)
{ {
#if defined(CONFIG_ANDROID)
class_compat_unregister(switch_class);
#endif
class_destroy(extcon_class); class_destroy(extcon_class);
} }
module_exit(extcon_class_exit); module_exit(extcon_class_exit);
......
...@@ -124,7 +124,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color) ...@@ -124,7 +124,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
node->initiated_reset = SELF_ID_PHY_INITIATOR(sid); node->initiated_reset = SELF_ID_PHY_INITIATOR(sid);
node->port_count = port_count; node->port_count = port_count;
atomic_set(&node->ref_count, 1); refcount_set(&node->ref_count, 1);
INIT_LIST_HEAD(&node->link); INIT_LIST_HEAD(&node->link);
return node; return node;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/atomic.h> #include <linux/refcount.h>
struct device; struct device;
struct fw_card; struct fw_card;
...@@ -184,7 +184,7 @@ struct fw_node { ...@@ -184,7 +184,7 @@ struct fw_node {
* local node to this node. */ * local node to this node. */
u8 max_depth:4; /* Maximum depth to any leaf node */ u8 max_depth:4; /* Maximum depth to any leaf node */
u8 max_hops:4; /* Max hops in this sub tree */ u8 max_hops:4; /* Max hops in this sub tree */
atomic_t ref_count; refcount_t ref_count;
/* For serializing node topology into a list. */ /* For serializing node topology into a list. */
struct list_head link; struct list_head link;
...@@ -197,14 +197,14 @@ struct fw_node { ...@@ -197,14 +197,14 @@ struct fw_node {
static inline struct fw_node *fw_node_get(struct fw_node *node) static inline struct fw_node *fw_node_get(struct fw_node *node)
{ {
atomic_inc(&node->ref_count); refcount_inc(&node->ref_count);
return node; return node;
} }
static inline void fw_node_put(struct fw_node *node) static inline void fw_node_put(struct fw_node *node)
{ {
if (atomic_dec_and_test(&node->ref_count)) if (refcount_dec_and_test(&node->ref_count))
kfree(node); kfree(node);
} }
......
config GOOGLE_FIRMWARE menuconfig GOOGLE_FIRMWARE
bool "Google Firmware Drivers" bool "Google Firmware Drivers"
depends on X86
default n default n
help help
These firmware drivers are used by Google's servers. They are These firmware drivers are used by Google's servers. They are
only useful if you are working directly on one of their only useful if you are working directly on one of their
proprietary servers. If in doubt, say "N". proprietary servers. If in doubt, say "N".
menu "Google Firmware Drivers" if GOOGLE_FIRMWARE
depends on GOOGLE_FIRMWARE
config GOOGLE_SMI config GOOGLE_SMI
tristate "SMI interface for Google platforms" tristate "SMI interface for Google platforms"
depends on ACPI && DMI && EFI depends on X86 && ACPI && DMI && EFI
select EFI_VARS select EFI_VARS
help help
Say Y here if you want to enable SMI callbacks for Google Say Y here if you want to enable SMI callbacks for Google
...@@ -20,12 +18,57 @@ config GOOGLE_SMI ...@@ -20,12 +18,57 @@ config GOOGLE_SMI
clearing the EFI event log and reading and writing NVRAM clearing the EFI event log and reading and writing NVRAM
variables. variables.
config GOOGLE_COREBOOT_TABLE
tristate
depends on GOOGLE_COREBOOT_TABLE_ACPI || GOOGLE_COREBOOT_TABLE_OF
config GOOGLE_COREBOOT_TABLE_ACPI
tristate "Coreboot Table Access - ACPI"
depends on ACPI
select GOOGLE_COREBOOT_TABLE
help
This option enables the coreboot_table module, which provides other
firmware modules to access to the coreboot table. The coreboot table
pointer is accessed through the ACPI "GOOGCB00" object.
If unsure say N.
config GOOGLE_COREBOOT_TABLE_OF
tristate "Coreboot Table Access - Device Tree"
depends on OF
select GOOGLE_COREBOOT_TABLE
help
This option enable the coreboot_table module, which provide other
firmware modules to access coreboot table. The coreboot table pointer
is accessed through the device tree node /firmware/coreboot.
If unsure say N.
config GOOGLE_MEMCONSOLE config GOOGLE_MEMCONSOLE
tristate "Firmware Memory Console" tristate
depends on DMI depends on GOOGLE_MEMCONSOLE_X86_LEGACY || GOOGLE_MEMCONSOLE_COREBOOT
config GOOGLE_MEMCONSOLE_X86_LEGACY
tristate "Firmware Memory Console - X86 Legacy support"
depends on X86 && ACPI && DMI
select GOOGLE_MEMCONSOLE
help help
This option enables the kernel to search for a firmware log in This option enables the kernel to search for a firmware log in
the EBDA on Google servers. If found, this log is exported to the EBDA on Google servers. If found, this log is exported to
userland in the file /sys/firmware/log. userland in the file /sys/firmware/log.
endmenu config GOOGLE_MEMCONSOLE_COREBOOT
tristate "Firmware Memory Console"
depends on GOOGLE_COREBOOT_TABLE
select GOOGLE_MEMCONSOLE
help
This option enables the kernel to search for a firmware log in
the coreboot table. If found, this log is exported to userland
in the file /sys/firmware/log.
config GOOGLE_VPD
tristate "Vital Product Data"
depends on GOOGLE_COREBOOT_TABLE
help
This option enables the kernel to expose the content of Google VPD
under /sys/firmware/vpd.
endif # GOOGLE_FIRMWARE
obj-$(CONFIG_GOOGLE_SMI) += gsmi.o obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o obj-$(CONFIG_GOOGLE_COREBOOT_TABLE) += coreboot_table.o
obj-$(CONFIG_GOOGLE_COREBOOT_TABLE_ACPI) += coreboot_table-acpi.o
obj-$(CONFIG_GOOGLE_COREBOOT_TABLE_OF) += coreboot_table-of.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE_COREBOOT) += memconsole-coreboot.o
obj-$(CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY) += memconsole-x86-legacy.o
vpd-sysfs-y := vpd.o vpd_decode.o
obj-$(CONFIG_GOOGLE_VPD) += vpd-sysfs.o
/*
* coreboot_table-acpi.c
*
* Using ACPI to locate Coreboot table and provide coreboot table access.
*
* Copyright 2017 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include "coreboot_table.h"
static int coreboot_table_acpi_probe(struct platform_device *pdev)
{
phys_addr_t phyaddr;
resource_size_t len;
struct coreboot_table_header __iomem *header = NULL;
struct resource *res;
void __iomem *ptr = NULL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -EINVAL;
len = resource_size(res);
if (!res->start || !len)
return -EINVAL;
phyaddr = res->start;
header = ioremap_cache(phyaddr, sizeof(*header));
if (header == NULL)
return -ENOMEM;
ptr = ioremap_cache(phyaddr,
header->header_bytes + header->table_bytes);
iounmap(header);
if (!ptr)
return -ENOMEM;
return coreboot_table_init(ptr);
}
static int coreboot_table_acpi_remove(struct platform_device *pdev)
{
return coreboot_table_exit();
}
static const struct acpi_device_id cros_coreboot_acpi_match[] = {
{ "GOOGCB00", 0 },
{ "BOOT0000", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, cros_coreboot_acpi_match);
static struct platform_driver coreboot_table_acpi_driver = {
.probe = coreboot_table_acpi_probe,
.remove = coreboot_table_acpi_remove,
.driver = {
.name = "coreboot_table_acpi",
.acpi_match_table = ACPI_PTR(cros_coreboot_acpi_match),
},
};
static int __init coreboot_table_acpi_init(void)
{
return platform_driver_register(&coreboot_table_acpi_driver);
}
module_init(coreboot_table_acpi_init);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");
/*
* coreboot_table-of.c
*
* Coreboot table access through open firmware.
*
* Copyright 2017 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/device.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include "coreboot_table.h"
static int coreboot_table_of_probe(struct platform_device *pdev)
{
struct device_node *fw_dn = pdev->dev.of_node;
void __iomem *ptr;
ptr = of_iomap(fw_dn, 0);
of_node_put(fw_dn);
if (!ptr)
return -ENOMEM;
return coreboot_table_init(ptr);
}
static int coreboot_table_of_remove(struct platform_device *pdev)
{
return coreboot_table_exit();
}
static const struct of_device_id coreboot_of_match[] = {
{ .compatible = "coreboot" },
{},
};
static struct platform_driver coreboot_table_of_driver = {
.probe = coreboot_table_of_probe,
.remove = coreboot_table_of_remove,
.driver = {
.name = "coreboot_table_of",
.of_match_table = coreboot_of_match,
},
};
static int __init platform_coreboot_table_of_init(void)
{
struct platform_device *pdev;
struct device_node *of_node;
/* Limit device creation to the presence of /firmware/coreboot node */
of_node = of_find_node_by_path("/firmware/coreboot");
if (!of_node)
return -ENODEV;
if (!of_match_node(coreboot_of_match, of_node))
return -ENODEV;
pdev = of_platform_device_create(of_node, "coreboot_table_of", NULL);
if (!pdev)
return -ENODEV;
return platform_driver_register(&coreboot_table_of_driver);
}
module_init(platform_coreboot_table_of_init);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");
/*
* coreboot_table.c
*
* Module providing coreboot table access.
*
* Copyright 2017 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include "coreboot_table.h"
struct coreboot_table_entry {
u32 tag;
u32 size;
};
static struct coreboot_table_header __iomem *ptr_header;
/*
* This function parses the coreboot table for an entry that contains the base
* address of the given entry tag. The coreboot table consists of a header
* directly followed by a number of small, variable-sized entries, which each
* contain an identifying tag and their length as the first two fields.
*/
int coreboot_table_find(int tag, void *data, size_t data_size)
{
struct coreboot_table_header header;
struct coreboot_table_entry entry;
void *ptr_entry;
int i;
if (!ptr_header)
return -EPROBE_DEFER;
memcpy_fromio(&header, ptr_header, sizeof(header));
if (strncmp(header.signature, "LBIO", sizeof(header.signature))) {
pr_warn("coreboot_table: coreboot table missing or corrupt!\n");
return -ENODEV;
}
ptr_entry = (void *)ptr_header + header.header_bytes;
for (i = 0; i < header.table_entries; i++) {
memcpy_fromio(&entry, ptr_entry, sizeof(entry));
if (entry.tag == tag) {
if (data_size < entry.size)
return -EINVAL;
memcpy_fromio(data, ptr_entry, entry.size);
return 0;
}
ptr_entry += entry.size;
}
return -ENOENT;
}
EXPORT_SYMBOL(coreboot_table_find);
int coreboot_table_init(void __iomem *ptr)
{
ptr_header = ptr;
return 0;
}
EXPORT_SYMBOL(coreboot_table_init);
int coreboot_table_exit(void)
{
if (ptr_header)
iounmap(ptr_header);
return 0;
}
EXPORT_SYMBOL(coreboot_table_exit);
MODULE_AUTHOR("Google, Inc.");
MODULE_LICENSE("GPL");
/*
* coreboot_table.h
*
* Internal header for coreboot table access.
*
* Copyright 2017 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License v2.0 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __COREBOOT_TABLE_H
#define __COREBOOT_TABLE_H
#include <linux/io.h>
/* List of coreboot entry structures that is used */
struct lb_cbmem_ref {
uint32_t tag;
uint32_t size;
uint64_t cbmem_addr;
};
/* Coreboot table header structure */
struct coreboot_table_header {
char signature[4];
u32 header_bytes;
u32 header_checksum;
u32 table_bytes;
u32 table_checksum;
u32 table_entries;
};
/* Retrieve coreboot table entry with tag *tag* and copy it to data */
int coreboot_table_find(int tag, void *data, size_t data_size);
/* Initialize coreboot table module given a pointer to iomem */
int coreboot_table_init(void __iomem *ptr);
/* Cleanup coreboot table module */
int coreboot_table_exit(void);
#endif /* __COREBOOT_TABLE_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment