- New Drivers

- Add support for Ampere Computing SMpro
    - Add support for TI TPS65219 PMIC
 
  - New Functionality
    - Add support for multiple devices of the same type; rk808
 
  - Fix-ups
    - Convert a bunch of I2C class drivers over to .probe_new()
    - Remove superfluous includes; mc13xxx-*, palmas, timberdale
    - Use correct includes for GPIO handling; madera-core
    - Convert to GPIOD; twl6040
    - Remove unused platform data handling; twl6040
    - Device Tree changes; many
    - Remove unused drivers; dm355evm_msp, davinci_voicecodec, htc-i2cpld
    - Add support for modules; palmas
    - Enable COMPILE_TEST support; intel_soc_pmic*
    - Trivial: spelling / whitespace fixes; mc13xxx-spi
    - Replace old PM helpers with new ones; many
    - Convert deprecated mask_invert usage to unmask_base; many
    - Use devm_*() calls; qcom_rpm
    - MAINTAINER fix-ups
    - Make use of improved / replaced APIs; palmas, fsl-imx25-tsadc,
                                            stm32-lptimer, qcom_rpm, rohm-*
 
  - Bug Fixes
    - Add bounds / error checking; mt6360-core
    - No sleeping inside critical sections; axp20x
    - Fix missing dependencies; ROHM_BD957XMUF
    - Repair error paths; qcom-pm8008
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmOhmWgACgkQUa+KL4f8
 d2GEMA/+LQ+1Iv/MS8xh9a5SNs3lUJcHmNe8j1OhdD62usl1gQa9HegyL+h60Ajm
 r+MAxO3s0iTvPJFi9+i9S/BdO0XtdF1+0eIFm3Qih4A8NUDeK4wnr1J+5fswYvPG
 5Nvut/sqIQhCoT64T7009pwdRx8S5b1Von7+hGfDoC3UN0cGqW8+/3K0lEE4I1FY
 RaDKwS4Wvs3zZdfs/EQ0ILqTJKp0Mw3qKEbS9rB2XaLwa/eteZAeZBuypJDH9XLY
 GkJDeX51jLynjA7mp10p7bf1v6/p8JXcBUaz/vvPwYIM2oV46PHw9dbtzuPzz9iD
 O12reYGhssuVRTN8fCm+T82Jo99TiWrhagJG3gTqtrFQrs19w341Vetb7wDn14+z
 rL88pCo7xHLYwPGKXfup2GaGVt5GP6zEr6REnelw9yGmuxbAWajwWK2x64TAReGV
 8rOUt1VQyaY874dQ0iulrs+bKwaaPnpDgEzUeB6b4LG6zYoupQFD1+dfIzRq8k42
 wnAg5QdzcWFWzBOH0neUkyq7iZvLL3S5pLRWTENV8rLvEiNIPzWAMPHGFeYO8xm2
 lx+6B5XVfGd3oMze8mFwbrkLlpzbRS1j8bIV6kwlbcw44mw0w/EKtNW8Qlxw8HWA
 lvR9M/+NzniaCM8yJVZcB97k5r5ukZ6rSfQWCm9htIzdvLW09iM=
 =HT19
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Add support for Ampere Computing SMpro
   - Add support for TI TPS65219 PMIC

  New Functionality:
   - Add support for multiple devices of the same type; rk808

  Fix-ups:
   - Convert a bunch of I2C class drivers over to .probe_new()
   - Remove superfluous includes; mc13xxx-*, palmas, timberdale
   - Use correct includes for GPIO handling; madera-core
   - Convert to GPIOD; twl6040
   - Remove unused platform data handling; twl6040
   - Device Tree changes; many
   - Remove unused drivers; dm355evm_msp, davinci_voicecodec, htc-i2cpld
   - Add support for modules; palmas
   - Enable COMPILE_TEST support; intel_soc_pmic*
   - Trivial: spelling / whitespace fixes; mc13xxx-spi
   - Replace old PM helpers with new ones; many
   - Convert deprecated mask_invert usage to unmask_base; many
   - Use devm_*() calls; qcom_rpm
   - MAINTAINER fix-ups
   - Make use of improved / replaced APIs; palmas, fsl-imx25-tsadc,
     stm32-lptimer, qcom_rpm, rohm-*

  Bug Fixes:
   - Add bounds / error checking; mt6360-core
   - No sleeping inside critical sections; axp20x
   - Fix missing dependencies; ROHM_BD957XMUF
   - Repair error paths; qcom-pm8008"

* tag 'mfd-next-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (161 commits)
  dt-bindings: mfd: da9062: Correct file name for watchdog
  mfd: pm8008: Fix return value check in pm8008_probe()
  mfd: rohm: Use dev_err_probe()
  mfd: Drop obsolete dependencies on COMPILE_TEST
  dt-bindings: mfd: da9062: Move IRQ to optional properties
  mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code
  mfd: qcom_rpm: Fix an error handling path in qcom_rpm_probe()
  mfd: stm32-lptimer: Use devm_platform_get_and_ioremap_resource()
  mfd: rohm-bd9576: Convert to i2c's .probe_new()
  mfd: fsl-imx25-tsadc: Use devm_platform_get_and_ioremap_resource()
  dt-bindings: Fix maintainer email for a few ROHM ICs
  mfd: palmas: Use device_get_match_data() to simplify the code
  Input: Add tps65219 interrupt driven powerbutton
  mfd: tps65219: Add driver for TI TPS65219 PMIC
  mfd: bd957x: Fix Kconfig dependency on REGMAP_IRQ
  mfd: wcd934x: Convert irq chip to config regs
  mfd: tps65090: Replace irqchip mask_invert with unmask_base
  mfd: sun4i-gpadc: Replace irqchip mask_invert with unmask_base
  mfd: stpmic1: Fix swapped mask/unmask in irq chip
  mfd: sprd-sc27xx-spi: Replace irqchip mask_invert with unmask_base
  ...
This commit is contained in:
Linus Torvalds 2022-12-21 09:19:24 -08:00
commit 7406fd75a9
152 changed files with 1506 additions and 2366 deletions

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71828 Power Management Integrated Circuit LED driver
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
This module is part of the ROHM BD71828 MFD device. For more details

View File

@ -0,0 +1,42 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Ampere Altra SMPro firmware driver
maintainers:
- Quan Nguyen <quan@os.amperecomputing.com>
description: |
Ampere Altra SMPro firmware may contain different blocks like hardware
monitoring, error monitoring and other miscellaneous features.
properties:
compatible:
enum:
- ampere,smpro
reg:
description:
I2C device address.
maxItems: 1
required:
- compatible
- reg
additionalProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
smpro@4f {
compatible = "ampere,smpro";
reg = <0x4f>;
};
};

View File

@ -36,6 +36,9 @@ properties:
const: 1
patternProperties:
'^timer@[a-f0-9]+$':
$ref: /schemas/timer/brcm,bcmbca-timer.yaml
'^watchdog@[a-f0-9]+$':
$ref: /schemas/watchdog/brcm,bcm7038-wdt.yaml
@ -54,6 +57,11 @@ examples:
#address-cells = <1>;
#size-cells = <1>;
timer@0 {
compatible = "brcm,bcm63138-timer";
reg = <0x0 0x28>;
};
watchdog@28 {
compatible = "brcm,bcm7038-wdt";
reg = <0x28 0x8>;

View File

@ -33,11 +33,6 @@ Required properties:
"dlg,da9061" for DA9061
- reg : Specifies the I2C slave address (this defaults to 0x58 but it can be
modified to match the chip's OTP settings).
- interrupts : IRQ line information.
- interrupt-controller
See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
further information on IRQ bindings.
Optional properties:
@ -48,6 +43,12 @@ Optional properties:
See Documentation/devicetree/bindings/gpio/gpio.txt for further information on
GPIO bindings.
- interrupts : IRQ line information.
- interrupt-controller
See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt for
further information on IRQ bindings.
Sub-nodes:
- regulators : This node defines the settings for the LDOs and BUCKs.
@ -85,7 +86,7 @@ Sub-nodes:
- onkey : See ../input/da9062-onkey.txt
- watchdog: See ../watchdog/da9062-watchdog.txt
- watchdog: See ../watchdog/da9062-wdt.txt
- thermal : See ../thermal/da9062-thermal.txt

View File

@ -12,7 +12,8 @@ maintainers:
description: |
The Ocelot ethernet switch family contains chips that have an internal CPU
(VSC7513, VSC7514) and chips that don't (VSC7511, VSC7512). All switches have
the option to be controlled externally, which is the purpose of this driver.
the option to be controlled externally via external interfaces like SPI or
PCIe.
The switch family is a multi-port networking switch that supports many
interfaces. Additionally, the device can perform pin control, MDIO buses, and
@ -61,7 +62,6 @@ required:
- reg
- '#address-cells'
- '#size-cells'
- spi-max-frequency
additionalProperties: false

View File

@ -21,6 +21,7 @@ Required properties:
compatible:
"mediatek,mt6323" for PMIC MT6323
"mediatek,mt6331" for PMIC MT6331 and MT6332
"mediatek,mt6357" for PMIC MT6357
"mediatek,mt6358" for PMIC MT6358 and MT6366
"mediatek,mt6359" for PMIC MT6359
"mediatek,mt6397" for PMIC MT6397

View File

@ -99,10 +99,16 @@ properties:
type: object
$ref: /schemas/regulator/qcom,spmi-regulator.yaml#
pwm:
type: object
$ref: /schemas/leds/leds-qcom-lpg.yaml#
patternProperties:
"^adc@[0-9a-f]+$":
type: object
$ref: /schemas/iio/adc/qcom,spmi-vadc.yaml#
oneOf:
- $ref: /schemas/iio/adc/qcom,spmi-iadc.yaml#
- $ref: /schemas/iio/adc/qcom,spmi-vadc.yaml#
"^adc-tm@[0-9a-f]+$":
type: object
@ -112,11 +118,13 @@ patternProperties:
type: object
additionalProperties: true # FIXME qcom,pm8916-wcd-analog-codec binding not converted yet
"extcon@[0-9a-f]+$":
"^charger@[0-9a-f]+$":
type: object
$ref: /schemas/extcon/qcom,pm8941-misc.yaml#
oneOf:
- $ref: /schemas/power/supply/qcom,pm8941-charger.yaml#
- $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml#
"gpio(s)?@[0-9a-f]+$":
"gpio@[0-9a-f]+$":
type: object
$ref: /schemas/pinctrl/qcom,pmic-gpio.yaml#
@ -124,10 +132,6 @@ patternProperties:
type: object
$ref: /schemas/power/reset/qcom,pon.yaml#
"pwm@[0-9a-f]+$":
type: object
$ref: /schemas/leds/leds-qcom-lpg.yaml#
"^rtc@[0-9a-f]+$":
type: object
$ref: /schemas/rtc/qcom-pm8xxx-rtc.yaml#
@ -136,9 +140,17 @@ patternProperties:
type: object
$ref: /schemas/thermal/qcom,spmi-temp-alarm.yaml#
"^usb-detect@[0-9a-f]+$":
type: object
$ref: /schemas/extcon/qcom,pm8941-misc.yaml#
"^usb-vbus-regulator@[0-9a-f]+$":
type: object
$ref: /schemas/regulator/qcom,usb-vbus-regulator.yaml#
"^vibrator@[0-9a-f]+$":
type: object
additionalProperties: true # FIXME qcom,pm8916-vib binding not converted yet
$ref: /schemas/input/qcom,pm8xxx-vib.yaml#
"^mpps@[0-9a-f]+$":
type: object
@ -200,7 +212,7 @@ examples:
#address-cells = <1>;
#size-cells = <0>;
pmi8998_gpio: gpios@c000 {
pmi8998_gpio: gpio@c000 {
compatible = "qcom,pmi8998-gpio", "qcom,spmi-gpio";
reg = <0xc000>;
gpio-controller;
@ -285,7 +297,7 @@ examples:
};
};
pm6150_gpio: gpios@c000 {
pm6150_gpio: gpio@c000 {
compatible = "qcom,pm6150-gpio", "qcom,spmi-gpio";
reg = <0xc000>;
gpio-controller;

View File

@ -17,10 +17,12 @@ properties:
compatible:
items:
- enum:
- qcom,msm8976-tcsr
- qcom,msm8998-tcsr
- qcom,qcs404-tcsr
- qcom,sc7180-tcsr
- qcom,sc7280-tcsr
- qcom,sc8280xp-tcsr
- qcom,sdm630-tcsr
- qcom,sdm845-tcsr
- qcom,sm8150-tcsr

View File

@ -15,11 +15,15 @@ description: |
properties:
compatible:
enum:
- qcom,pm8018
- qcom,pm8058
- qcom,pm8821
- qcom,pm8921
oneOf:
- enum:
- qcom,pm8058
- qcom,pm8821
- qcom,pm8921
- items:
- enum:
- qcom,pm8018
- const: qcom,pm8921
reg:
maxItems: 1
@ -56,4 +60,23 @@ required:
- interrupt-controller
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
ssbi {
#address-cells = <1>;
#size-cells = <0>;
pmic@0 {
compatible = "qcom,pm8921";
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
interrupt-controller;
#interrupt-cells = <2>;
interrupt-parent = <&tlmm>;
interrupts = <32 IRQ_TYPE_EDGE_RISING>;
};
};
...

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71815 Power Management Integrated Circuit
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
BD71815AGW is a single-chip power management ICs for battery-powered

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71828 Power Management Integrated Circuit
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
BD71828GW is a single-chip power management IC for battery-powered portable

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71837 Power Management Integrated Circuit
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
BD71837MWV is programmable Power Management ICs for powering single-core,

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71847 and BD71850 Power Management Integrated Circuit
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
BD71847AMWV and BD71850MWV are programmable Power Management ICs for powering

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD9576MUF and BD9573MUF Power Management Integrated Circuit
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
BD9576MUF and BD9573MUF are power management ICs primarily intended for

View File

@ -53,6 +53,7 @@ properties:
- microchip,lan966x-cpu-syscon
- microchip,sparx5-cpu-syscon
- mstar,msc313-pmsleep
- nuvoton,wpcm450-shm
- rockchip,px30-qos
- rockchip,rk3036-qos
- rockchip,rk3066-qos

View File

@ -52,6 +52,9 @@ properties:
type: object
description: Magnetic reader
power-domains:
maxItems: 1
required:
- compatible
- reg

View File

@ -26,7 +26,9 @@ properties:
compatible:
items:
- enum:
- ti,j7200-system-controller
- ti,j721e-system-controller
- ti,j721s2-system-controller
- const: syscon
- const: simple-mfd

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD99954 Battery charger
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
- Markus Laine <markus.laine@fi.rohmeurope.com>
- Mikko Mutanen <mikko.mutanen@fi.rohmeurope.com>

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71815 Power Management Integrated Circuit regulators
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
This module is part of the ROHM BD718215 MFD device. For more details

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71828 Power Management Integrated Circuit regulators
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
This module is part of the ROHM BD71828 MFD device. For more details

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71837 Power Management Integrated Circuit regulators
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
List of regulators provided by this controller. BD71837 regulators node

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD71847 and BD71850 Power Management Integrated Circuit regulators
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
List of regulators provided by this controller. BD71847 regulators node

View File

@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: ROHM BD9576 and BD9573 Power Management Integrated Circuit regulators
maintainers:
- Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
- Matti Vaittinen <mazziesaccount@gmail.com>
description: |
This module is part of the ROHM BD9576 MFD device. For more details

View File

@ -0,0 +1,40 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/timer/brcm,bcmbca-timer.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Broadcom Broadband SoC timer
maintainers:
- Rafał Miłecki <rafal@milecki.pl>
properties:
compatible:
oneOf:
- const: brcm,bcm6345-timer
description: >
An old block with 3 timers.
It can be found in BCM6345, BCM6838 and BCM63268.
- const: brcm,bcm63138-timer
description: >
Updated block with 4 timers and control regs at the beginning.
It can be found in newer SoCs, e.g. BCM63138, BCM63148, BCM63381,
BCM68360, BCM6848, BCM6858, BCM4908.
reg:
maxItems: 1
additionalProperties: false
required:
- reg
examples:
- |
timer@fffe0200 {
compatible = "brcm,bcm6345-timer";
reg = <0xfffe0200 0x1c>;
};

View File

@ -15336,6 +15336,7 @@ F: drivers/mfd/menelaus.c
F: drivers/mfd/palmas.c
F: drivers/mfd/tps65217.c
F: drivers/mfd/tps65218.c
F: drivers/mfd/tps65219.c
F: drivers/mfd/tps65910.c
F: drivers/mfd/twl-core.[ch]
F: drivers/mfd/twl4030*.c

View File

@ -468,6 +468,16 @@ config INPUT_TPS65218_PWRBUTTON
To compile this driver as a module, choose M here. The module will
be called tps65218-pwrbutton.
config INPUT_TPS65219_PWRBUTTON
tristate "TPS65219 Power button driver"
depends on MFD_TPS65219
help
Say Y here if you want to enable power button reporting for
TPS65219 Power Management IC devices.
To compile this driver as a module, choose M here. The module will
be called tps65219-pwrbutton.
config INPUT_AXP20X_PEK
tristate "X-Powers AXP20X power button driver"
depends on MFD_AXP20X
@ -662,17 +672,6 @@ config INPUT_DA9063_ONKEY
To compile this driver as a module, choose M here: the module
will be called da9063_onkey.
config INPUT_DM355EVM
tristate "TI DaVinci DM355 EVM Keypad and IR Remote"
depends on MFD_DM355EVM_MSP
select INPUT_SPARSEKMAP
help
Supports the pushbuttons and IR remote used with
the DM355 EVM board.
To compile this driver as a module, choose M here: the
module will be called dm355evm_keys.
config INPUT_WM831X_ON
tristate "WM831X ON pin"
depends on MFD_WM831X

View File

@ -31,7 +31,6 @@ obj-$(CONFIG_INPUT_DA7280_HAPTICS) += da7280.o
obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o
obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o
obj-$(CONFIG_INPUT_DA9063_ONKEY) += da9063_onkey.o
obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o
obj-$(CONFIG_INPUT_E3X0_BUTTON) += e3x0-button.o
obj-$(CONFIG_INPUT_DRV260X_HAPTICS) += drv260x.o
obj-$(CONFIG_INPUT_DRV2665_HAPTICS) += drv2665.o
@ -80,6 +79,7 @@ obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
obj-$(CONFIG_INPUT_STPMIC1_ONKEY) += stpmic1_onkey.o
obj-$(CONFIG_INPUT_TPS65218_PWRBUTTON) += tps65218-pwrbutton.o
obj-$(CONFIG_INPUT_TPS65219_PWRBUTTON) += tps65219-pwrbutton.o
obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o
obj-$(CONFIG_INPUT_TWL4030_VIBRA) += twl4030-vibra.o
obj-$(CONFIG_INPUT_TWL6040_VIBRA) += twl6040-vibra.o

View File

@ -1,238 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* dm355evm_keys.c - support buttons and IR remote on DM355 EVM board
*
* Copyright (c) 2008 by David Brownell
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/mfd/dm355evm_msp.h>
#include <linux/module.h>
/*
* The MSP430 firmware on the DM355 EVM monitors on-board pushbuttons
* and an IR receptor used for the remote control. When any key is
* pressed, or its autorepeat kicks in, an event is sent. This driver
* read those events from the small (32 event) queue and reports them.
*
* Note that physically there can only be one of these devices.
*
* This driver was tested with firmware revision A4.
*/
struct dm355evm_keys {
struct input_dev *input;
struct device *dev;
};
/* These initial keycodes can be remapped */
static const struct key_entry dm355evm_keys[] = {
/*
* Pushbuttons on the EVM board ... note that the labels for these
* are SW10/SW11/etc on the PC board. The left/right orientation
* comes only from the firmware's documentation, and presumes the
* power connector is immediately in front of you and the IR sensor
* is to the right. (That is, rotate the board counter-clockwise
* by 90 degrees from the SW10/etc and "DM355 EVM" labels.)
*/
{ KE_KEY, 0x00d8, { KEY_OK } }, /* SW12 */
{ KE_KEY, 0x00b8, { KEY_UP } }, /* SW13 */
{ KE_KEY, 0x00e8, { KEY_DOWN } }, /* SW11 */
{ KE_KEY, 0x0078, { KEY_LEFT } }, /* SW14 */
{ KE_KEY, 0x00f0, { KEY_RIGHT } }, /* SW10 */
/*
* IR buttons ... codes assigned to match the universal remote
* provided with the EVM (Philips PM4S) using DVD code 0020.
*
* These event codes match firmware documentation, but other
* remote controls could easily send more RC5-encoded events.
* The PM4S manual was used in several cases to help select
* a keycode reflecting the intended usage.
*
* RC5 codes are 14 bits, with two start bits (0x3 prefix)
* and a toggle bit (masked out below).
*/
{ KE_KEY, 0x300c, { KEY_POWER } }, /* NOTE: docs omit this */
{ KE_KEY, 0x3000, { KEY_NUMERIC_0 } },
{ KE_KEY, 0x3001, { KEY_NUMERIC_1 } },
{ KE_KEY, 0x3002, { KEY_NUMERIC_2 } },
{ KE_KEY, 0x3003, { KEY_NUMERIC_3 } },
{ KE_KEY, 0x3004, { KEY_NUMERIC_4 } },
{ KE_KEY, 0x3005, { KEY_NUMERIC_5 } },
{ KE_KEY, 0x3006, { KEY_NUMERIC_6 } },
{ KE_KEY, 0x3007, { KEY_NUMERIC_7 } },
{ KE_KEY, 0x3008, { KEY_NUMERIC_8 } },
{ KE_KEY, 0x3009, { KEY_NUMERIC_9 } },
{ KE_KEY, 0x3022, { KEY_ENTER } },
{ KE_KEY, 0x30ec, { KEY_MODE } }, /* "tv/vcr/..." */
{ KE_KEY, 0x300f, { KEY_SELECT } }, /* "info" */
{ KE_KEY, 0x3020, { KEY_CHANNELUP } }, /* "up" */
{ KE_KEY, 0x302e, { KEY_MENU } }, /* "in/out" */
{ KE_KEY, 0x3011, { KEY_VOLUMEDOWN } }, /* "left" */
{ KE_KEY, 0x300d, { KEY_MUTE } }, /* "ok" */
{ KE_KEY, 0x3010, { KEY_VOLUMEUP } }, /* "right" */
{ KE_KEY, 0x301e, { KEY_SUBTITLE } }, /* "cc" */
{ KE_KEY, 0x3021, { KEY_CHANNELDOWN } },/* "down" */
{ KE_KEY, 0x3022, { KEY_PREVIOUS } },
{ KE_KEY, 0x3026, { KEY_SLEEP } },
{ KE_KEY, 0x3172, { KEY_REWIND } }, /* NOTE: docs wrongly say 0x30ca */
{ KE_KEY, 0x3175, { KEY_PLAY } },
{ KE_KEY, 0x3174, { KEY_FASTFORWARD } },
{ KE_KEY, 0x3177, { KEY_RECORD } },
{ KE_KEY, 0x3176, { KEY_STOP } },
{ KE_KEY, 0x3169, { KEY_PAUSE } },
};
/*
* Because we communicate with the MSP430 using I2C, and all I2C calls
* in Linux sleep, we use a threaded IRQ handler. The IRQ itself is
* active low, but we go through the GPIO controller so we can trigger
* on falling edges and not worry about enabling/disabling the IRQ in
* the keypress handling path.
*/
static irqreturn_t dm355evm_keys_irq(int irq, void *_keys)
{
static u16 last_event;
struct dm355evm_keys *keys = _keys;
const struct key_entry *ke;
unsigned int keycode;
int status;
u16 event;
/* For simplicity we ignore INPUT_COUNT and just read
* events until we get the "queue empty" indicator.
* Reading INPUT_LOW decrements the count.
*/
for (;;) {
status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH);
if (status < 0) {
dev_dbg(keys->dev, "input high err %d\n",
status);
break;
}
event = status << 8;
status = dm355evm_msp_read(DM355EVM_MSP_INPUT_LOW);
if (status < 0) {
dev_dbg(keys->dev, "input low err %d\n",
status);
break;
}
event |= status;
if (event == 0xdead)
break;
/* Press and release a button: two events, same code.
* Press and hold (autorepeat), then release: N events
* (N > 2), same code. For RC5 buttons the toggle bits
* distinguish (for example) "1-autorepeat" from "1 1";
* but PCB buttons don't support that bit.
*
* So we must synthesize release events. We do that by
* mapping events to a press/release event pair; then
* to avoid adding extra events, skip the second event
* of each pair.
*/
if (event == last_event) {
last_event = 0;
continue;
}
last_event = event;
/* ignore the RC5 toggle bit */
event &= ~0x0800;
/* find the key, or report it as unknown */
ke = sparse_keymap_entry_from_scancode(keys->input, event);
keycode = ke ? ke->keycode : KEY_UNKNOWN;
dev_dbg(keys->dev,
"input event 0x%04x--> keycode %d\n",
event, keycode);
/* report press + release */
input_report_key(keys->input, keycode, 1);
input_sync(keys->input);
input_report_key(keys->input, keycode, 0);
input_sync(keys->input);
}
return IRQ_HANDLED;
}
/*----------------------------------------------------------------------*/
static int dm355evm_keys_probe(struct platform_device *pdev)
{
struct dm355evm_keys *keys;
struct input_dev *input;
int irq;
int error;
keys = devm_kzalloc(&pdev->dev, sizeof (*keys), GFP_KERNEL);
if (!keys)
return -ENOMEM;
input = devm_input_allocate_device(&pdev->dev);
if (!input)
return -ENOMEM;
keys->dev = &pdev->dev;
keys->input = input;
input->name = "DM355 EVM Controls";
input->phys = "dm355evm/input0";
input->id.bustype = BUS_I2C;
input->id.product = 0x0355;
input->id.version = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
error = sparse_keymap_setup(input, dm355evm_keys, NULL);
if (error)
return error;
/* REVISIT: flush the event queue? */
/* set up "threaded IRQ handler" */
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
error = devm_request_threaded_irq(&pdev->dev, irq,
NULL, dm355evm_keys_irq,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
dev_name(&pdev->dev), keys);
if (error)
return error;
/* register */
error = input_register_device(input);
if (error)
return error;
return 0;
}
/* REVISIT: add suspend/resume when DaVinci supports it. The IRQ should
* be able to wake up the system. When device_may_wakeup(&pdev->dev), call
* enable_irq_wake() on suspend, and disable_irq_wake() on resume.
*/
/*
* I2C is used to talk to the MSP430, but this platform device is
* exposed by an MFD driver that manages I2C communications.
*/
static struct platform_driver dm355evm_keys_driver = {
.probe = dm355evm_keys_probe,
.driver = {
.name = "dm355evm_keys",
},
};
module_platform_driver(dm355evm_keys_driver);
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,148 @@
// SPDX-License-Identifier: GPL-2.0
//
// Driver for TPS65219 Push Button
//
// Copyright (C) 2022 BayLibre Incorporated - https://www.baylibre.com/
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mfd/tps65219.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
struct tps65219_pwrbutton {
struct device *dev;
struct input_dev *idev;
char phys[32];
};
static irqreturn_t tps65219_pb_push_irq(int irq, void *_pwr)
{
struct tps65219_pwrbutton *pwr = _pwr;
input_report_key(pwr->idev, KEY_POWER, 1);
pm_wakeup_event(pwr->dev, 0);
input_sync(pwr->idev);
return IRQ_HANDLED;
}
static irqreturn_t tps65219_pb_release_irq(int irq, void *_pwr)
{
struct tps65219_pwrbutton *pwr = _pwr;
input_report_key(pwr->idev, KEY_POWER, 0);
input_sync(pwr->idev);
return IRQ_HANDLED;
}
static int tps65219_pb_probe(struct platform_device *pdev)
{
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev;
struct tps65219_pwrbutton *pwr;
struct input_dev *idev;
int error;
int push_irq;
int release_irq;
pwr = devm_kzalloc(dev, sizeof(*pwr), GFP_KERNEL);
if (!pwr)
return -ENOMEM;
idev = devm_input_allocate_device(dev);
if (!idev)
return -ENOMEM;
idev->name = pdev->name;
snprintf(pwr->phys, sizeof(pwr->phys), "%s/input0",
pdev->name);
idev->phys = pwr->phys;
idev->id.bustype = BUS_I2C;
input_set_capability(idev, EV_KEY, KEY_POWER);
pwr->dev = dev;
pwr->idev = idev;
device_init_wakeup(dev, true);
push_irq = platform_get_irq(pdev, 0);
if (push_irq < 0)
return -EINVAL;
release_irq = platform_get_irq(pdev, 1);
if (release_irq < 0)
return -EINVAL;
error = devm_request_threaded_irq(dev, push_irq, NULL,
tps65219_pb_push_irq,
IRQF_ONESHOT,
dev->init_name, pwr);
if (error) {
dev_err(dev, "failed to request push IRQ #%d: %d\n", push_irq,
error);
return error;
}
error = devm_request_threaded_irq(dev, release_irq, NULL,
tps65219_pb_release_irq,
IRQF_ONESHOT,
dev->init_name, pwr);
if (error) {
dev_err(dev, "failed to request release IRQ #%d: %d\n",
release_irq, error);
return error;
}
error = input_register_device(idev);
if (error) {
dev_err(dev, "Can't register power button: %d\n", error);
return error;
}
/* Enable interrupts for the pushbutton */
regmap_clear_bits(tps->regmap, TPS65219_REG_MASK_CONFIG,
TPS65219_REG_MASK_INT_FOR_PB_MASK);
/* Set PB/EN/VSENSE pin to be a pushbutton */
regmap_update_bits(tps->regmap, TPS65219_REG_MFP_2_CONFIG,
TPS65219_MFP_2_EN_PB_VSENSE_MASK, TPS65219_MFP_2_PB);
return 0;
}
static int tps65219_pb_remove(struct platform_device *pdev)
{
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
/* Disable interrupt for the pushbutton */
return regmap_update_bits(tps->regmap, TPS65219_REG_MASK_CONFIG,
TPS65219_REG_MASK_INT_FOR_PB_MASK,
TPS65219_REG_MASK_INT_FOR_PB_MASK);
}
static const struct platform_device_id tps65219_pwrbtn_id_table[] = {
{ "tps65219-pwrbutton", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(platform, tps65219_pwrbtn_id_table);
static struct platform_driver tps65219_pb_driver = {
.probe = tps65219_pb_probe,
.remove = tps65219_pb_remove,
.driver = {
.name = "tps65219_pwrbutton",
},
.id_table = tps65219_pwrbtn_id_table,
};
module_platform_driver(tps65219_pb_driver);
MODULE_DESCRIPTION("TPS65219 Power Button");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Markus Schneider-Pargmann <msp@baylibre.com");

View File

@ -398,9 +398,8 @@ static struct regmap_irq_chip pm800_irq_chip = {
.num_regs = 4,
.status_base = PM800_INT_STATUS1,
.mask_base = PM800_INT_ENA_1,
.unmask_base = PM800_INT_ENA_1,
.ack_base = PM800_INT_STATUS1,
.mask_invert = 1,
};
static int pm800_pages_init(struct pm80x_chip *chip)
@ -528,8 +527,7 @@ out:
return ret;
}
static int pm800_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int pm800_probe(struct i2c_client *client)
{
int ret = 0;
struct pm80x_chip *chip;
@ -597,9 +595,9 @@ static void pm800_remove(struct i2c_client *client)
static struct i2c_driver pm800_driver = {
.driver = {
.name = "88PM800",
.pm = &pm80x_pm_ops,
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe = pm800_probe,
.probe_new = pm800_probe,
.remove = pm800_remove,
.id_table = pm80x_id_table,
};

View File

@ -209,8 +209,7 @@ out_irq_init:
return ret;
}
static int pm805_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int pm805_probe(struct i2c_client *client)
{
int ret = 0;
struct pm80x_chip *chip;
@ -252,9 +251,9 @@ static void pm805_remove(struct i2c_client *client)
static struct i2c_driver pm805_driver = {
.driver = {
.name = "88PM805",
.pm = &pm80x_pm_ops,
.pm = pm_sleep_ptr(&pm80x_pm_ops),
},
.probe = pm805_probe,
.probe_new = pm805_probe,
.remove = pm805_remove,
.id_table = pm80x_id_table,
};

View File

@ -129,7 +129,6 @@ int pm80x_deinit(void)
}
EXPORT_SYMBOL_GPL(pm80x_deinit);
#ifdef CONFIG_PM_SLEEP
static int pm80x_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev)
return 0;
}
#endif
SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
EXPORT_SYMBOL_GPL(pm80x_pm_ops);
EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume);
MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x");
MODULE_AUTHOR("Qiao Zhou <zhouqiao@marvell.com>");

View File

@ -1212,7 +1212,6 @@ static void pm860x_remove(struct i2c_client *client)
}
}
#ifdef CONFIG_PM_SLEEP
static int pm860x_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -1232,9 +1231,8 @@ static int pm860x_resume(struct device *dev)
disable_irq_wake(chip->core_irq);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume);
static const struct i2c_device_id pm860x_id_table[] = {
{ "88PM860x", 0 },
@ -1251,7 +1249,7 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids);
static struct i2c_driver pm860x_driver = {
.driver = {
.name = "88PM860x",
.pm = &pm860x_pm_ops,
.pm = pm_sleep_ptr(&pm860x_pm_ops),
.of_match_table = pm860x_dt_ids,
},
.probe_new = pm860x_probe,

View File

@ -77,6 +77,18 @@ config MFD_AS3711
help
Support for the AS3711 PMIC from AMS
config MFD_SMPRO
tristate "Ampere Computing SMpro core driver"
depends on I2C
select MFD_CORE
select REGMAP_I2C
help
Say yes here to enable SMpro driver support for Ampere's Altra
processor family.
Ampere's Altra SMpro exposes an I2C regmap interface that can
be accessed by child devices.
config MFD_AS3722
tristate "ams AS3722 Power Management IC"
select MFD_CORE
@ -547,15 +559,6 @@ config HTC_PASIC3
HTC Magician devices, respectively. Actual functionality is
handled by the leds-pasic3 and ds1wm drivers.
config HTC_I2CPLD
bool "HTC I2C PLD chip support"
depends on I2C=y && GPIOLIB
help
If you say yes here you get support for the supposed CPLD
found on omap850 HTC devices like the HTC Wizard and HTC Herald.
This device provides input and output GPIOs through an I2C
interface to one or more sub-chips.
config MFD_INTEL_QUARK_I2C_GPIO
tristate "Intel Quark MFD I2C GPIO"
depends on PCI
@ -591,7 +594,7 @@ config INTEL_SOC_PMIC
bool "Support for Crystal Cove PMIC"
depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
depends on (X86 && ACPI) || COMPILE_TEST
depends on I2C_DESIGNWARE_PLATFORM=y
depends on I2C_DESIGNWARE_PLATFORM=y || COMPILE_TEST
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -794,7 +797,7 @@ config MFD_MAX14577
config MFD_MAX77620
bool "Maxim Semiconductor MAX77620 and MAX20024 PMIC Support"
depends on I2C=y
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -809,7 +812,7 @@ config MFD_MAX77620
config MFD_MAX77650
tristate "Maxim MAX77650/77651 PMIC Support"
depends on I2C
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -824,7 +827,7 @@ config MFD_MAX77650
config MFD_MAX77686
tristate "Maxim Semiconductor MAX77686/802 PMIC Support"
depends on I2C
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -853,7 +856,7 @@ config MFD_MAX77693
config MFD_MAX77714
tristate "Maxim Semiconductor MAX77714 PMIC Support"
depends on I2C
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
help
@ -1010,7 +1013,7 @@ config EZX_PCAP
config MFD_CPCAP
tristate "Support for Motorola CPCAP"
depends on SPI
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_SPI
select REGMAP_IRQ
@ -1035,7 +1038,7 @@ config MFD_VIPERBOARD
config MFD_NTXEC
tristate "Netronix embedded controller (EC)"
depends on OF || COMPILE_TEST
depends on OF
depends on I2C
select REGMAP_I2C
select MFD_CORE
@ -1231,7 +1234,7 @@ config MFD_RN5T618
config MFD_SEC_CORE
tristate "Samsung Electronics PMIC Series Support"
depends on I2C=y
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -1432,11 +1435,6 @@ config MFD_SYSCON
Select this option to enable accessing system control registers
via regmap.
config MFD_DAVINCI_VOICECODEC
tristate
select MFD_CORE
select REGMAP_MMIO
config MFD_TI_AM335X_TSCADC
tristate "TI ADC / Touch Screen chip support"
select MFD_CORE
@ -1448,14 +1446,6 @@ config MFD_TI_AM335X_TSCADC
To compile this driver as a module, choose M here: the
module will be called ti_am335x_tscadc.
config MFD_DM355EVM_MSP
bool "TI DaVinci DM355 EVM microcontroller"
depends on I2C=y && MACH_DAVINCI_DM355_EVM
help
This driver supports the MSP430 microcontroller used on these
boards. MSP430 firmware manages resets and power sequencing,
inputs from buttons and the IR remote, LEDs, an RTC, and more.
config MFD_LP3943
tristate "TI/National Semiconductor LP3943 MFD Driver"
depends on I2C
@ -1499,7 +1489,7 @@ config MFD_OMAP_USB_HOST
OMAP USB Host drivers.
config MFD_PALMAS
bool "TI Palmas series chips"
tristate "TI Palmas series chips"
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
@ -1635,6 +1625,20 @@ config MFD_TPS65218
This driver can also be built as a module. If so, the module
will be called tps65218.
config MFD_TPS65219
tristate "TI TPS65219 Power Management IC"
depends on I2C && OF
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
help
If you say yes here you get support for the TPS65219 series of Power
Management ICs. These include voltage regulators, GPIOs and
push/power button that is often used in portable devices.
This driver can also be built as a module. If so, the module
will be called tps65219.
config MFD_TPS6586X
bool "TI TPS6586x Power Management chips"
depends on I2C=y
@ -2027,6 +2031,7 @@ config MFD_ROHM_BD957XMUF
depends on I2C=y
depends on OF
select REGMAP_I2C
select REGMAP_IRQ
select MFD_CORE
help
Select this option to get support for the ROHM BD9576MUF and
@ -2077,7 +2082,7 @@ config MFD_STPMIC1
config MFD_STMFX
tristate "Support for STMicroelectronics Multi-Function eXpander (STMFX)"
depends on I2C
depends on OF || COMPILE_TEST
depends on OF
select MFD_CORE
select REGMAP_I2C
help

View File

@ -19,13 +19,9 @@ obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o
obj-$(CONFIG_MFD_GATEWORKS_GSC) += gateworks-gsc.o
obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o
obj-$(CONFIG_MFD_TI_LP873X) += lp873x.o
obj-$(CONFIG_MFD_TI_LP87565) += lp87565.o
obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o
obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
obj-$(CONFIG_MFD_TI_AM335X_TSCADC) += ti_am335x_tscadc.o
obj-$(CONFIG_MFD_STA2X11) += sta2x11-mfd.o
@ -101,6 +97,7 @@ obj-$(CONFIG_TPS6507X) += tps6507x.o
obj-$(CONFIG_MFD_TPS65086) += tps65086.o
obj-$(CONFIG_MFD_TPS65217) += tps65217.o
obj-$(CONFIG_MFD_TPS65218) += tps65218.o
obj-$(CONFIG_MFD_TPS65219) += tps65219.o
obj-$(CONFIG_MFD_TPS65910) += tps65910.o
obj-$(CONFIG_MFD_TPS65912) += tps65912-core.o
obj-$(CONFIG_MFD_TPS65912_I2C) += tps65912-i2c.o
@ -271,6 +268,7 @@ obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o
obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o
obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o
obj-$(CONFIG_MFD_SMPRO) += smpro-core.o
obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o
obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o

View File

@ -332,8 +332,7 @@ static inline void aat2870_init_debugfs(struct aat2870_data *aat2870)
}
#endif /* CONFIG_DEBUG_FS */
static int aat2870_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int aat2870_i2c_probe(struct i2c_client *client)
{
struct aat2870_platform_data *pdata = dev_get_platdata(&client->dev);
struct aat2870_data *aat2870;
@ -409,7 +408,6 @@ out_disable:
return ret;
}
#ifdef CONFIG_PM_SLEEP
static int aat2870_i2c_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -438,10 +436,9 @@ static int aat2870_i2c_resume(struct device *dev)
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend,
aat2870_i2c_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend,
aat2870_i2c_resume);
static const struct i2c_device_id aat2870_i2c_id_table[] = {
{ "aat2870", 0 },
@ -451,10 +448,10 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = {
static struct i2c_driver aat2870_i2c_driver = {
.driver = {
.name = "aat2870",
.pm = &aat2870_pm_ops,
.pm = pm_sleep_ptr(&aat2870_pm_ops),
.suppress_bind_attrs = true,
},
.probe = aat2870_i2c_probe,
.probe_new = aat2870_i2c_probe,
.id_table = aat2870_i2c_id_table,
};

View File

@ -28,8 +28,7 @@ static const struct regmap_config act8945a_regmap_config = {
.val_bits = 8,
};
static int act8945a_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int act8945a_i2c_probe(struct i2c_client *i2c)
{
int ret;
struct regmap *regmap;
@ -71,7 +70,7 @@ static struct i2c_driver act8945a_i2c_driver = {
.name = "act8945a",
.of_match_table = of_match_ptr(act8945a_of_match),
},
.probe = act8945a_i2c_probe,
.probe_new = act8945a_i2c_probe,
.id_table = act8945a_i2c_id,
};

View File

@ -204,9 +204,9 @@ static int adp5520_remove_subdevs(struct adp5520_chip *chip)
return device_for_each_child(chip->dev, NULL, __remove_subdev);
}
static int adp5520_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int adp5520_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct adp5520_platform_data *pdata = dev_get_platdata(&client->dev);
struct platform_device *pdev;
struct adp5520_chip *chip;
@ -305,7 +305,6 @@ out_free_irq:
return ret;
}
#ifdef CONFIG_PM_SLEEP
static int adp5520_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -326,9 +325,8 @@ static int adp5520_resume(struct device *dev)
adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume);
static const struct i2c_device_id adp5520_id[] = {
{ "pmic-adp5520", ID_ADP5520 },
@ -339,10 +337,10 @@ static const struct i2c_device_id adp5520_id[] = {
static struct i2c_driver adp5520_driver = {
.driver = {
.name = "adp5520",
.pm = &adp5520_pm,
.pm = pm_sleep_ptr(&adp5520_pm),
.suppress_bind_attrs = true,
},
.probe = adp5520_probe,
.probe_new = adp5520_probe,
.id_table = adp5520_id,
};
builtin_i2c_driver(adp5520_driver);

View File

@ -480,7 +480,6 @@ static int wm5102_clear_write_sequencer(struct arizona *arizona)
return 0;
}
#ifdef CONFIG_PM
static int arizona_isolate_dcvdd(struct arizona *arizona)
{
int ret;
@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev)
return 0;
}
#endif
#ifdef CONFIG_PM_SLEEP
static int arizona_suspend(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
@ -784,17 +781,15 @@ static int arizona_resume(struct device *dev)
return 0;
}
#endif
const struct dev_pm_ops arizona_pm_ops = {
SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
arizona_runtime_resume,
NULL)
SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
arizona_resume_noirq)
EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) = {
RUNTIME_PM_OPS(arizona_runtime_suspend,
arizona_runtime_resume,
NULL)
SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume)
NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq,
arizona_resume_noirq)
};
EXPORT_SYMBOL_GPL(arizona_pm_ops);
#ifdef CONFIG_OF
static int arizona_of_get_core_pdata(struct arizona *arizona)

View File

@ -20,9 +20,9 @@
#include "arizona.h"
static int arizona_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int arizona_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
const void *match_data;
struct arizona *arizona;
const struct regmap_config *regmap_config = NULL;
@ -117,10 +117,10 @@ static const struct of_device_id arizona_i2c_of_match[] = {
static struct i2c_driver arizona_i2c_driver = {
.driver = {
.name = "arizona",
.pm = &arizona_pm_ops,
.pm = pm_ptr(&arizona_pm_ops),
.of_match_table = of_match_ptr(arizona_i2c_of_match),
},
.probe = arizona_i2c_probe,
.probe_new = arizona_i2c_probe,
.remove = arizona_i2c_remove,
.id_table = arizona_i2c_id,
};

View File

@ -282,7 +282,7 @@ static const struct of_device_id arizona_spi_of_match[] = {
static struct spi_driver arizona_spi_driver = {
.driver = {
.name = "arizona",
.pm = &arizona_pm_ops,
.pm = pm_ptr(&arizona_pm_ops),
.of_match_table = of_match_ptr(arizona_spi_of_match),
.acpi_match_table = ACPI_PTR(arizona_acpi_match),
},

View File

@ -116,8 +116,7 @@ static const struct of_device_id as3711_of_match[] = {
};
#endif
static int as3711_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int as3711_i2c_probe(struct i2c_client *client)
{
struct as3711 *as3711;
struct as3711_platform_data *pdata;
@ -202,7 +201,7 @@ static struct i2c_driver as3711_i2c_driver = {
.name = "as3711",
.of_match_table = of_match_ptr(as3711_of_match),
},
.probe = as3711_i2c_probe,
.probe_new = as3711_i2c_probe,
.id_table = as3711_i2c_id,
};

View File

@ -333,8 +333,7 @@ static int as3722_i2c_of_probe(struct i2c_client *i2c,
return 0;
}
static int as3722_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int as3722_i2c_probe(struct i2c_client *i2c)
{
struct as3722 *as3722;
unsigned long irq_flags;
@ -446,7 +445,7 @@ static struct i2c_driver as3722_i2c_driver = {
.of_match_table = as3722_of_match,
.pm = &as3722_pm_ops,
},
.probe = as3722_i2c_probe,
.probe_new = as3722_i2c_probe,
.id_table = as3722_i2c_id,
};

View File

@ -100,8 +100,7 @@ static const struct regmap_irq_chip atc2603c_regmap_irq_chip = {
.num_irqs = ARRAY_SIZE(atc2603c_regmap_irqs),
.num_regs = 1,
.status_base = ATC2603C_INTS_PD,
.mask_base = ATC2603C_INTS_MSK,
.mask_invert = true,
.unmask_base = ATC2603C_INTS_MSK,
};
static const struct regmap_irq_chip atc2609a_regmap_irq_chip = {
@ -110,8 +109,7 @@ static const struct regmap_irq_chip atc2609a_regmap_irq_chip = {
.num_irqs = ARRAY_SIZE(atc2609a_regmap_irqs),
.num_regs = 1,
.status_base = ATC2609A_INTS_PD,
.mask_base = ATC2609A_INTS_MSK,
.mask_invert = true,
.unmask_base = ATC2609A_INTS_MSK,
};
static const struct resource atc2603c_onkey_resources[] = {

View File

@ -12,8 +12,7 @@
#include <linux/of.h>
#include <linux/regmap.h>
static int atc260x_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int atc260x_i2c_probe(struct i2c_client *client)
{
struct atc260x *atc260x;
struct regmap_config regmap_cfg;
@ -54,7 +53,7 @@ static struct i2c_driver atc260x_i2c_driver = {
.name = "atc260x",
.of_match_table = of_match_ptr(atc260x_i2c_of_match),
},
.probe = atc260x_i2c_probe,
.probe_new = atc260x_i2c_probe,
};
module_i2c_driver(atc260x_i2c_driver);

View File

@ -22,8 +22,7 @@
#include <linux/regmap.h>
#include <linux/slab.h>
static int axp20x_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int axp20x_i2c_probe(struct i2c_client *i2c)
{
struct axp20x_dev *axp20x;
int ret;
@ -100,7 +99,7 @@ static struct i2c_driver axp20x_i2c_driver = {
.of_match_table = of_match_ptr(axp20x_i2c_of_match),
.acpi_match_table = ACPI_PTR(axp20x_i2c_acpi_match),
},
.probe = axp20x_i2c_probe,
.probe_new = axp20x_i2c_probe,
.remove = axp20x_i2c_remove,
.id_table = axp20x_i2c_id,
};

View File

@ -506,8 +506,7 @@ static const struct regmap_irq_chip axp152_regmap_irq_chip = {
.name = "axp152_irq_chip",
.status_base = AXP152_IRQ1_STATE,
.ack_base = AXP152_IRQ1_STATE,
.mask_base = AXP152_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP152_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp152_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp152_regmap_irqs),
@ -518,8 +517,7 @@ static const struct regmap_irq_chip axp20x_regmap_irq_chip = {
.name = "axp20x_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp20x_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp20x_regmap_irqs),
@ -531,8 +529,7 @@ static const struct regmap_irq_chip axp22x_regmap_irq_chip = {
.name = "axp22x_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp22x_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp22x_regmap_irqs),
@ -543,8 +540,7 @@ static const struct regmap_irq_chip axp288_regmap_irq_chip = {
.name = "axp288_irq_chip",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp288_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp288_regmap_irqs),
@ -556,8 +552,7 @@ static const struct regmap_irq_chip axp803_regmap_irq_chip = {
.name = "axp803",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp803_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp803_regmap_irqs),
@ -568,8 +563,7 @@ static const struct regmap_irq_chip axp806_regmap_irq_chip = {
.name = "axp806",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp806_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp806_regmap_irqs),
@ -580,8 +574,7 @@ static const struct regmap_irq_chip axp809_regmap_irq_chip = {
.name = "axp809",
.status_base = AXP20X_IRQ1_STATE,
.ack_base = AXP20X_IRQ1_STATE,
.mask_base = AXP20X_IRQ1_EN,
.mask_invert = true,
.unmask_base = AXP20X_IRQ1_EN,
.init_ack_masked = true,
.irqs = axp809_regmap_irqs,
.num_irqs = ARRAY_SIZE(axp809_regmap_irqs),
@ -842,7 +835,7 @@ static void axp20x_power_off(void)
AXP20X_OFF);
/* Give capacitors etc. time to drain to avoid kernel panic msg. */
msleep(500);
mdelay(500);
}
int axp20x_match_device(struct axp20x_dev *axp20x)

View File

@ -38,8 +38,7 @@ static const struct regmap_config bcm590xx_regmap_config_sec = {
.cache_type = REGCACHE_RBTREE,
};
static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri,
const struct i2c_device_id *id)
static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri)
{
struct bcm590xx *bcm590xx;
int ret;
@ -109,7 +108,7 @@ static struct i2c_driver bcm590xx_i2c_driver = {
.name = "bcm590xx",
.of_match_table = bcm590xx_of_match,
},
.probe = bcm590xx_i2c_probe,
.probe_new = bcm590xx_i2c_probe,
.id_table = bcm590xx_i2c_id,
};
module_i2c_driver(bcm590xx_i2c_driver);

View File

@ -204,8 +204,7 @@ static int bd957x_identify(struct device *dev, struct regmap *regmap)
return 0;
}
static int bd9571mwv_probe(struct i2c_client *client,
const struct i2c_device_id *ids)
static int bd9571mwv_probe(struct i2c_client *client)
{
const struct regmap_config *regmap_config;
const struct regmap_irq_chip *irq_chip;
@ -279,7 +278,7 @@ static struct i2c_driver bd9571mwv_driver = {
.name = "bd9571mwv",
.of_match_table = bd9571mwv_of_match_table,
},
.probe = bd9571mwv_probe,
.probe_new = bd9571mwv_probe,
.id_table = bd9571mwv_id_table,
};
module_i2c_driver(bd9571mwv_driver);

View File

@ -488,9 +488,9 @@ failed:
return ret;
}
static int da903x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int da903x_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct da903x_platform_data *pdata = dev_get_platdata(&client->dev);
struct da903x_chip *chip;
unsigned int tmp;
@ -543,7 +543,7 @@ static struct i2c_driver da903x_driver = {
.driver = {
.name = "da903x",
},
.probe = da903x_probe,
.probe_new = da903x_probe,
.remove = da903x_remove,
.id_table = da903x_id_table,
};

View File

@ -126,9 +126,9 @@ static const struct of_device_id dialog_dt_ids[] = {
};
#endif
static int da9052_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int da9052_i2c_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct da9052 *da9052;
int ret;
@ -176,7 +176,7 @@ static void da9052_i2c_remove(struct i2c_client *client)
}
static struct i2c_driver da9052_i2c_driver = {
.probe = da9052_i2c_probe,
.probe_new = da9052_i2c_probe,
.remove = da9052_i2c_remove,
.id_table = da9052_i2c_id,
.driver = {

View File

@ -15,8 +15,7 @@
#include <linux/mfd/da9055/core.h>
static int da9055_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int da9055_i2c_probe(struct i2c_client *i2c)
{
struct da9055 *da9055;
int ret;
@ -67,7 +66,7 @@ static const struct of_device_id da9055_of_match[] = {
};
static struct i2c_driver da9055_i2c_driver = {
.probe = da9055_i2c_probe,
.probe_new = da9055_i2c_probe,
.remove = da9055_i2c_remove,
.id_table = da9055_i2c_id,
.driver = {

View File

@ -621,9 +621,9 @@ static const struct of_device_id da9062_dt_ids[] = {
};
MODULE_DEVICE_TABLE(of, da9062_dt_ids);
static int da9062_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int da9062_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct da9062 *chip;
unsigned int irq_base;
const struct mfd_cell *cell;
@ -744,7 +744,7 @@ static struct i2c_driver da9062_i2c_driver = {
.name = "da9062",
.of_match_table = da9062_dt_ids,
},
.probe = da9062_i2c_probe,
.probe_new = da9062_i2c_probe,
.remove = da9062_i2c_remove,
.id_table = da9062_i2c_id,
};

View File

@ -351,9 +351,9 @@ static const struct of_device_id da9063_dt_ids[] = {
{ }
};
MODULE_DEVICE_TABLE(of, da9063_dt_ids);
static int da9063_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int da9063_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct da9063 *da9063;
int ret;
@ -469,7 +469,7 @@ static struct i2c_driver da9063_i2c_driver = {
.name = "da9063",
.of_match_table = da9063_dt_ids,
},
.probe = da9063_i2c_probe,
.probe_new = da9063_i2c_probe,
.id_table = da9063_i2c_id,
};

View File

@ -392,8 +392,7 @@ static struct mfd_cell da9150_devs[] = {
},
};
static int da9150_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int da9150_probe(struct i2c_client *client)
{
struct da9150 *da9150;
struct da9150_pdata *pdata = dev_get_platdata(&client->dev);
@ -511,7 +510,7 @@ static struct i2c_driver da9150_driver = {
.name = "da9150",
.of_match_table = da9150_of_match,
},
.probe = da9150_probe,
.probe_new = da9150_probe,
.remove = da9150_remove,
.shutdown = da9150_shutdown,
.id_table = da9150_i2c_id,

View File

@ -1,136 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* DaVinci Voice Codec Core Interface for TI platforms
*
* Copyright (C) 2010 Texas Instruments, Inc
*
* Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/regmap.h>
#include <sound/pcm.h>
#include <linux/mfd/davinci_voicecodec.h>
static const struct regmap_config davinci_vc_regmap = {
.reg_bits = 32,
.val_bits = 32,
};
static int __init davinci_vc_probe(struct platform_device *pdev)
{
struct davinci_vc *davinci_vc;
struct resource *res;
struct mfd_cell *cell = NULL;
dma_addr_t fifo_base;
int ret;
davinci_vc = devm_kzalloc(&pdev->dev,
sizeof(struct davinci_vc), GFP_KERNEL);
if (!davinci_vc)
return -ENOMEM;
davinci_vc->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(davinci_vc->clk)) {
dev_dbg(&pdev->dev,
"could not get the clock for voice codec\n");
return -ENODEV;
}
clk_enable(davinci_vc->clk);
davinci_vc->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(davinci_vc->base)) {
ret = PTR_ERR(davinci_vc->base);
goto fail;
}
fifo_base = (dma_addr_t)res->start;
davinci_vc->regmap = devm_regmap_init_mmio(&pdev->dev,
davinci_vc->base,
&davinci_vc_regmap);
if (IS_ERR(davinci_vc->regmap)) {
ret = PTR_ERR(davinci_vc->regmap);
goto fail;
}
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
goto fail;
}
davinci_vc->davinci_vcif.dma_tx_channel = res->start;
davinci_vc->davinci_vcif.dma_tx_addr = fifo_base + DAVINCI_VC_WFIFO;
res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
if (!res) {
dev_err(&pdev->dev, "no DMA resource\n");
ret = -ENXIO;
goto fail;
}
davinci_vc->davinci_vcif.dma_rx_channel = res->start;
davinci_vc->davinci_vcif.dma_rx_addr = fifo_base + DAVINCI_VC_RFIFO;
davinci_vc->dev = &pdev->dev;
davinci_vc->pdev = pdev;
/* Voice codec interface client */
cell = &davinci_vc->cells[DAVINCI_VC_VCIF_CELL];
cell->name = "davinci-vcif";
cell->platform_data = davinci_vc;
cell->pdata_size = sizeof(*davinci_vc);
/* Voice codec CQ93VC client */
cell = &davinci_vc->cells[DAVINCI_VC_CQ93VC_CELL];
cell->name = "cq93vc-codec";
cell->platform_data = davinci_vc;
cell->pdata_size = sizeof(*davinci_vc);
ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells,
DAVINCI_VC_CELLS, NULL, 0, NULL);
if (ret != 0) {
dev_err(&pdev->dev, "fail to register client devices\n");
goto fail;
}
return 0;
fail:
clk_disable(davinci_vc->clk);
return ret;
}
static int davinci_vc_remove(struct platform_device *pdev)
{
struct davinci_vc *davinci_vc = platform_get_drvdata(pdev);
mfd_remove_devices(&pdev->dev);
clk_disable(davinci_vc->clk);
return 0;
}
static struct platform_driver davinci_vc_driver = {
.driver = {
.name = "davinci_voicecodec",
},
.remove = davinci_vc_remove,
};
module_platform_driver_probe(davinci_vc_driver, davinci_vc_probe);
MODULE_AUTHOR("Miguel Aguilar");
MODULE_DESCRIPTION("Texas Instruments DaVinci Voice Codec Core Interface");
MODULE_LICENSE("GPL");

View File

@ -1,454 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board
*
* Copyright (C) 2008 David Brownell
*/
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/leds.h>
#include <linux/i2c.h>
#include <linux/mfd/dm355evm_msp.h>
/*
* The DM355 is a DaVinci chip with video support but no C64+ DSP. Its
* EVM board has an MSP430 programmed with firmware for various board
* support functions. This driver exposes some of them directly, and
* supports other drivers (e.g. RTC, input) for more complex access.
*
* Because this firmware is entirely board-specific, this file embeds
* knowledge that would be passed as platform_data in a generic driver.
*
* This driver was tested with firmware revision A4.
*/
#if IS_ENABLED(CONFIG_INPUT_DM355EVM)
#define msp_has_keyboard() true
#else
#define msp_has_keyboard() false
#endif
#if IS_ENABLED(CONFIG_LEDS_GPIO)
#define msp_has_leds() true
#else
#define msp_has_leds() false
#endif
#if IS_ENABLED(CONFIG_RTC_DRV_DM355EVM)
#define msp_has_rtc() true
#else
#define msp_has_rtc() false
#endif
#if IS_ENABLED(CONFIG_VIDEO_TVP514X)
#define msp_has_tvp() true
#else
#define msp_has_tvp() false
#endif
/*----------------------------------------------------------------------*/
/* REVISIT for paranoia's sake, retry reads/writes on error */
static struct i2c_client *msp430;
/**
* dm355evm_msp_write - Writes a register in dm355evm_msp
* @value: the value to be written
* @reg: register address
*
* Returns result of operation - 0 is success, else negative errno
*/
int dm355evm_msp_write(u8 value, u8 reg)
{
return i2c_smbus_write_byte_data(msp430, reg, value);
}
EXPORT_SYMBOL(dm355evm_msp_write);
/**
* dm355evm_msp_read - Reads a register from dm355evm_msp
* @reg: register address
*
* Returns result of operation - value, or negative errno
*/
int dm355evm_msp_read(u8 reg)
{
return i2c_smbus_read_byte_data(msp430, reg);
}
EXPORT_SYMBOL(dm355evm_msp_read);
/*----------------------------------------------------------------------*/
/*
* Many of the msp430 pins are just used as fixed-direction GPIOs.
* We could export a few more of them this way, if we wanted.
*/
#define MSP_GPIO(bit, reg) ((DM355EVM_MSP_ ## reg) << 3 | (bit))
static const u8 msp_gpios[] = {
/* eight leds */
MSP_GPIO(0, LED), MSP_GPIO(1, LED),
MSP_GPIO(2, LED), MSP_GPIO(3, LED),
MSP_GPIO(4, LED), MSP_GPIO(5, LED),
MSP_GPIO(6, LED), MSP_GPIO(7, LED),
/* SW6 and the NTSC/nPAL jumper */
MSP_GPIO(0, SWITCH1), MSP_GPIO(1, SWITCH1),
MSP_GPIO(2, SWITCH1), MSP_GPIO(3, SWITCH1),
MSP_GPIO(4, SWITCH1),
/* switches on MMC/SD sockets */
/*
* Note: EVMDM355_ECP_VA4.pdf suggests that Bit 2 and 4 should be
* checked for card detection. However on the EVM bit 1 and 3 gives
* this status, for 0 and 1 instance respectively. The pdf also
* suggests that Bit 1 and 3 should be checked for write protection.
* However on the EVM bit 2 and 4 gives this status,for 0 and 1
* instance respectively.
*/
MSP_GPIO(2, SDMMC), MSP_GPIO(1, SDMMC), /* mmc0 WP, nCD */
MSP_GPIO(4, SDMMC), MSP_GPIO(3, SDMMC), /* mmc1 WP, nCD */
};
static struct gpio_led evm_leds[] = {
{ .name = "dm355evm::ds14",
.default_trigger = "heartbeat", },
{ .name = "dm355evm::ds15",
.default_trigger = "mmc0", },
{ .name = "dm355evm::ds16",
/* could also be a CE-ATA drive */
.default_trigger = "mmc1", },
{ .name = "dm355evm::ds17",
.default_trigger = "nand-disk", },
{ .name = "dm355evm::ds18", },
{ .name = "dm355evm::ds19", },
{ .name = "dm355evm::ds20", },
{ .name = "dm355evm::ds21", },
};
static struct gpio_led_platform_data evm_led_data = {
.num_leds = ARRAY_SIZE(evm_leds),
.leds = evm_leds,
};
static struct gpiod_lookup_table evm_leds_gpio_table = {
.dev_id = "leds-gpio",
.table = {
/*
* These GPIOs are on the dm355evm_msp
* GPIO chip at index 0..7
*/
GPIO_LOOKUP_IDX("dm355evm_msp", 0, NULL,
0, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 1, NULL,
1, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 2, NULL,
2, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 3, NULL,
3, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 4, NULL,
4, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 5, NULL,
5, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 6, NULL,
6, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("dm355evm_msp", 7, NULL,
7, GPIO_ACTIVE_LOW),
{ },
},
};
#define MSP_GPIO_REG(offset) (msp_gpios[(offset)] >> 3)
#define MSP_GPIO_MASK(offset) BIT(msp_gpios[(offset)] & 0x07)
static int msp_gpio_in(struct gpio_chip *chip, unsigned offset)
{
switch (MSP_GPIO_REG(offset)) {
case DM355EVM_MSP_SWITCH1:
case DM355EVM_MSP_SWITCH2:
case DM355EVM_MSP_SDMMC:
return 0;
default:
return -EINVAL;
}
}
static u8 msp_led_cache;
static int msp_gpio_get(struct gpio_chip *chip, unsigned offset)
{
int reg, status;
reg = MSP_GPIO_REG(offset);
status = dm355evm_msp_read(reg);
if (status < 0)
return status;
if (reg == DM355EVM_MSP_LED)
msp_led_cache = status;
return !!(status & MSP_GPIO_MASK(offset));
}
static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)
{
int mask, bits;
/* NOTE: there are some other signals that could be
* packaged as output GPIOs, but they aren't as useful
* as the LEDs ... so for now we don't.
*/
if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED)
return -EINVAL;
mask = MSP_GPIO_MASK(offset);
bits = msp_led_cache;
bits &= ~mask;
if (value)
bits |= mask;
msp_led_cache = bits;
return dm355evm_msp_write(bits, DM355EVM_MSP_LED);
}
static void msp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
msp_gpio_out(chip, offset, value);
}
static struct gpio_chip dm355evm_msp_gpio = {
.label = "dm355evm_msp",
.owner = THIS_MODULE,
.direction_input = msp_gpio_in,
.get = msp_gpio_get,
.direction_output = msp_gpio_out,
.set = msp_gpio_set,
.base = -EINVAL, /* dynamic assignment */
.ngpio = ARRAY_SIZE(msp_gpios),
.can_sleep = true,
};
/*----------------------------------------------------------------------*/
static struct device *add_child(struct i2c_client *client, const char *name,
void *pdata, unsigned pdata_len,
bool can_wakeup, int irq)
{
struct platform_device *pdev;
int status;
pdev = platform_device_alloc(name, -1);
if (!pdev)
return ERR_PTR(-ENOMEM);
device_init_wakeup(&pdev->dev, can_wakeup);
pdev->dev.parent = &client->dev;
if (pdata) {
status = platform_device_add_data(pdev, pdata, pdata_len);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add platform_data\n");
goto put_device;
}
}
if (irq) {
struct resource r = {
.start = irq,
.flags = IORESOURCE_IRQ,
};
status = platform_device_add_resources(pdev, &r, 1);
if (status < 0) {
dev_dbg(&pdev->dev, "can't add irq\n");
goto put_device;
}
}
status = platform_device_add(pdev);
if (status)
goto put_device;
return &pdev->dev;
put_device:
platform_device_put(pdev);
dev_err(&client->dev, "failed to add device %s\n", name);
return ERR_PTR(status);
}
static int add_children(struct i2c_client *client)
{
static const struct {
int offset;
char *label;
} config_inputs[] = {
/* 8 == right after the LEDs */
{ 8 + 0, "sw6_1", },
{ 8 + 1, "sw6_2", },
{ 8 + 2, "sw6_3", },
{ 8 + 3, "sw6_4", },
{ 8 + 4, "NTSC/nPAL", },
};
struct device *child;
int status;
int i;
/* GPIO-ish stuff */
dm355evm_msp_gpio.parent = &client->dev;
status = gpiochip_add_data(&dm355evm_msp_gpio, NULL);
if (status < 0)
return status;
/* LED output */
if (msp_has_leds()) {
gpiod_add_lookup_table(&evm_leds_gpio_table);
/* NOTE: these are the only fully programmable LEDs
* on the board, since GPIO-61/ds22 (and many signals
* going to DC7) must be used for AEMIF address lines
* unless the top 1 GB of NAND is unused...
*/
child = add_child(client, "leds-gpio",
&evm_led_data, sizeof(evm_led_data),
false, 0);
if (IS_ERR(child))
return PTR_ERR(child);
}
/* configuration inputs */
for (i = 0; i < ARRAY_SIZE(config_inputs); i++) {
int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset;
gpio_request_one(gpio, GPIOF_IN, config_inputs[i].label);
/* make it easy for userspace to see these */
gpio_export(gpio, false);
}
/* MMC/SD inputs -- right after the last config input */
if (dev_get_platdata(&client->dev)) {
void (*mmcsd_setup)(unsigned) = dev_get_platdata(&client->dev);
mmcsd_setup(dm355evm_msp_gpio.base + 8 + 5);
}
/* RTC is a 32 bit counter, no alarm */
if (msp_has_rtc()) {
child = add_child(client, "rtc-dm355evm",
NULL, 0, false, 0);
if (IS_ERR(child))
return PTR_ERR(child);
}
/* input from buttons and IR remote (uses the IRQ) */
if (msp_has_keyboard()) {
child = add_child(client, "dm355evm_keys",
NULL, 0, true, client->irq);
if (IS_ERR(child))
return PTR_ERR(child);
}
return 0;
}
/*----------------------------------------------------------------------*/
static void dm355evm_command(unsigned command)
{
int status;
status = dm355evm_msp_write(command, DM355EVM_MSP_COMMAND);
if (status < 0)
dev_err(&msp430->dev, "command %d failure %d\n",
command, status);
}
static void dm355evm_power_off(void)
{
dm355evm_command(MSP_COMMAND_POWEROFF);
}
static void dm355evm_msp_remove(struct i2c_client *client)
{
pm_power_off = NULL;
msp430 = NULL;
}
static int
dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
int status;
const char *video = msp_has_tvp() ? "TVP5146" : "imager";
if (msp430)
return -EBUSY;
msp430 = client;
/* display revision status; doubles as sanity check */
status = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
if (status < 0)
goto fail;
dev_info(&client->dev, "firmware v.%02X, %s as video-in\n",
status, video);
/* mux video input: either tvp5146 or some external imager */
status = dm355evm_msp_write(msp_has_tvp() ? 0 : MSP_VIDEO_IMAGER,
DM355EVM_MSP_VIDEO_IN);
if (status < 0)
dev_warn(&client->dev, "error %d muxing %s as video-in\n",
status, video);
/* init LED cache, and turn off the LEDs */
msp_led_cache = 0xff;
dm355evm_msp_write(msp_led_cache, DM355EVM_MSP_LED);
/* export capabilities we support */
status = add_children(client);
if (status < 0)
goto fail;
/* PM hookup */
pm_power_off = dm355evm_power_off;
return 0;
fail:
/* FIXME remove children ... */
dm355evm_msp_remove(client);
return status;
}
static const struct i2c_device_id dm355evm_msp_ids[] = {
{ "dm355evm_msp", 0 },
{ /* end of list */ },
};
MODULE_DEVICE_TABLE(i2c, dm355evm_msp_ids);
static struct i2c_driver dm355evm_msp_driver = {
.driver.name = "dm355evm_msp",
.id_table = dm355evm_msp_ids,
.probe = dm355evm_msp_probe,
.remove = dm355evm_msp_remove,
};
static int __init dm355evm_msp_init(void)
{
return i2c_add_driver(&dm355evm_msp_driver);
}
subsys_initcall(dm355evm_msp_init);
static void __exit dm355evm_msp_exit(void)
{
i2c_del_driver(&dm355evm_msp_driver);
}
module_exit(dm355evm_msp_exit);
MODULE_DESCRIPTION("Interface to MSP430 firmware on DM355EVM");
MODULE_LICENSE("GPL");

View File

@ -137,7 +137,6 @@ static int mx25_tsadc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct mx25_tsadc *tsadc;
struct resource *res;
int ret;
void __iomem *iomem;
@ -145,8 +144,7 @@ static int mx25_tsadc_probe(struct platform_device *pdev)
if (!tsadc)
return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iomem = devm_ioremap_resource(dev, res);
iomem = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(iomem))
return PTR_ERR(iomem);

View File

@ -189,8 +189,7 @@ static const struct regmap_irq_chip gsc_irq_chip = {
.num_irqs = ARRAY_SIZE(gsc_irqs),
.num_regs = 1,
.status_base = GSC_IRQ_STATUS,
.mask_base = GSC_IRQ_ENABLE,
.mask_invert = true,
.unmask_base = GSC_IRQ_ENABLE,
.ack_base = GSC_IRQ_STATUS,
.ack_invert = true,
};

View File

@ -1,627 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* htc-i2cpld.c
* Chip driver for an unknown CPLD chip found on omap850 HTC devices like
* the HTC Wizard and HTC Herald.
* The cpld is located on the i2c bus and acts as an input/output GPIO
* extender.
*
* Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com>
*
* Based on work done in the linwizard project
* Copyright (C) 2008-2009 Angelo Arrifano <miknix@gmail.com>
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/spinlock.h>
#include <linux/htcpld.h>
#include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.h>
struct htcpld_chip {
spinlock_t lock;
/* chip info */
u8 reset;
u8 addr;
struct device *dev;
struct i2c_client *client;
/* Output details */
u8 cache_out;
struct gpio_chip chip_out;
/* Input details */
u8 cache_in;
struct gpio_chip chip_in;
u16 irqs_enabled;
uint irq_start;
int nirqs;
unsigned int flow_type;
/*
* Work structure to allow for setting values outside of any
* possible interrupt context
*/
struct work_struct set_val_work;
};
struct htcpld_data {
/* irq info */
u16 irqs_enabled;
uint irq_start;
int nirqs;
uint chained_irq;
struct gpio_desc *int_reset_gpio_hi;
struct gpio_desc *int_reset_gpio_lo;
/* htcpld info */
struct htcpld_chip *chip;
unsigned int nchips;
};
/* There does not appear to be a way to proactively mask interrupts
* on the htcpld chip itself. So, we simply ignore interrupts that
* aren't desired. */
static void htcpld_mask(struct irq_data *data)
{
struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
chip->irqs_enabled &= ~(1 << (data->irq - chip->irq_start));
pr_debug("HTCPLD mask %d %04x\n", data->irq, chip->irqs_enabled);
}
static void htcpld_unmask(struct irq_data *data)
{
struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
chip->irqs_enabled |= 1 << (data->irq - chip->irq_start);
pr_debug("HTCPLD unmask %d %04x\n", data->irq, chip->irqs_enabled);
}
static int htcpld_set_type(struct irq_data *data, unsigned int flags)
{
struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
if (flags & ~IRQ_TYPE_SENSE_MASK)
return -EINVAL;
/* We only allow edge triggering */
if (flags & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))
return -EINVAL;
chip->flow_type = flags;
return 0;
}
static struct irq_chip htcpld_muxed_chip = {
.name = "htcpld",
.irq_mask = htcpld_mask,
.irq_unmask = htcpld_unmask,
.irq_set_type = htcpld_set_type,
};
/* To properly dispatch IRQ events, we need to read from the
* chip. This is an I2C action that could possibly sleep
* (which is bad in interrupt context) -- so we use a threaded
* interrupt handler to get around that.
*/
static irqreturn_t htcpld_handler(int irq, void *dev)
{
struct htcpld_data *htcpld = dev;
unsigned int i;
unsigned long flags;
int irqpin;
if (!htcpld) {
pr_debug("htcpld is null in ISR\n");
return IRQ_HANDLED;
}
/*
* For each chip, do a read of the chip and trigger any interrupts
* desired. The interrupts will be triggered from LSB to MSB (i.e.
* bit 0 first, then bit 1, etc.)
*
* For chips that have no interrupt range specified, just skip 'em.
*/
for (i = 0; i < htcpld->nchips; i++) {
struct htcpld_chip *chip = &htcpld->chip[i];
struct i2c_client *client;
int val;
unsigned long uval, old_val;
if (!chip) {
pr_debug("chip %d is null in ISR\n", i);
continue;
}
if (chip->nirqs == 0)
continue;
client = chip->client;
if (!client) {
pr_debug("client %d is null in ISR\n", i);
continue;
}
/* Scan the chip */
val = i2c_smbus_read_byte_data(client, chip->cache_out);
if (val < 0) {
/* Throw a warning and skip this chip */
dev_warn(chip->dev, "Unable to read from chip: %d\n",
val);
continue;
}
uval = (unsigned long)val;
spin_lock_irqsave(&chip->lock, flags);
/* Save away the old value so we can compare it */
old_val = chip->cache_in;
/* Write the new value */
chip->cache_in = uval;
spin_unlock_irqrestore(&chip->lock, flags);
/*
* For each bit in the data (starting at bit 0), trigger
* associated interrupts.
*/
for (irqpin = 0; irqpin < chip->nirqs; irqpin++) {
unsigned oldb, newb, type = chip->flow_type;
irq = chip->irq_start + irqpin;
/* Run the IRQ handler, but only if the bit value
* changed, and the proper flags are set */
oldb = (old_val >> irqpin) & 1;
newb = (uval >> irqpin) & 1;
if ((!oldb && newb && (type & IRQ_TYPE_EDGE_RISING)) ||
(oldb && !newb && (type & IRQ_TYPE_EDGE_FALLING))) {
pr_debug("fire IRQ %d\n", irqpin);
generic_handle_irq(irq);
}
}
}
/*
* In order to continue receiving interrupts, the int_reset_gpio must
* be asserted.
*/
if (htcpld->int_reset_gpio_hi)
gpiod_set_value(htcpld->int_reset_gpio_hi, 1);
if (htcpld->int_reset_gpio_lo)
gpiod_set_value(htcpld->int_reset_gpio_lo, 0);
return IRQ_HANDLED;
}
/*
* The GPIO set routines can be called from interrupt context, especially if,
* for example they're attached to the led-gpio framework and a trigger is
* enabled. As such, we declared work above in the htcpld_chip structure,
* and that work is scheduled in the set routine. The kernel can then run
* the I2C functions, which will sleep, in process context.
*/
static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val)
{
struct i2c_client *client;
struct htcpld_chip *chip_data = gpiochip_get_data(chip);
unsigned long flags;
client = chip_data->client;
if (!client)
return;
spin_lock_irqsave(&chip_data->lock, flags);
if (val)
chip_data->cache_out |= (1 << offset);
else
chip_data->cache_out &= ~(1 << offset);
spin_unlock_irqrestore(&chip_data->lock, flags);
schedule_work(&(chip_data->set_val_work));
}
static void htcpld_chip_set_ni(struct work_struct *work)
{
struct htcpld_chip *chip_data;
struct i2c_client *client;
chip_data = container_of(work, struct htcpld_chip, set_val_work);
client = chip_data->client;
i2c_smbus_read_byte_data(client, chip_data->cache_out);
}
static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset)
{
struct htcpld_chip *chip_data = gpiochip_get_data(chip);
u8 cache;
if (!strncmp(chip->label, "htcpld-out", 10)) {
cache = chip_data->cache_out;
} else if (!strncmp(chip->label, "htcpld-in", 9)) {
cache = chip_data->cache_in;
} else
return -EINVAL;
return (cache >> offset) & 1;
}
static int htcpld_direction_output(struct gpio_chip *chip,
unsigned offset, int value)
{
htcpld_chip_set(chip, offset, value);
return 0;
}
static int htcpld_direction_input(struct gpio_chip *chip,
unsigned offset)
{
/*
* No-op: this function can only be called on the input chip.
* We do however make sure the offset is within range.
*/
return (offset < chip->ngpio) ? 0 : -EINVAL;
}
static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset)
{
struct htcpld_chip *chip_data = gpiochip_get_data(chip);
if (offset < chip_data->nirqs)
return chip_data->irq_start + offset;
else
return -EINVAL;
}
static void htcpld_chip_reset(struct i2c_client *client)
{
struct htcpld_chip *chip_data = i2c_get_clientdata(client);
if (!chip_data)
return;
i2c_smbus_read_byte_data(
client, (chip_data->cache_out = chip_data->reset));
}
static int htcpld_setup_chip_irq(
struct platform_device *pdev,
int chip_index)
{
struct htcpld_data *htcpld;
struct htcpld_chip *chip;
unsigned int irq, irq_end;
/* Get the platform and driver data */
htcpld = platform_get_drvdata(pdev);
chip = &htcpld->chip[chip_index];
/* Setup irq handlers */
irq_end = chip->irq_start + chip->nirqs;
for (irq = chip->irq_start; irq < irq_end; irq++) {
irq_set_chip_and_handler(irq, &htcpld_muxed_chip,
handle_simple_irq);
irq_set_chip_data(irq, chip);
irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
}
return 0;
}
static int htcpld_register_chip_i2c(
struct platform_device *pdev,
int chip_index)
{
struct htcpld_data *htcpld;
struct device *dev = &pdev->dev;
struct htcpld_core_platform_data *pdata;
struct htcpld_chip *chip;
struct htcpld_chip_platform_data *plat_chip_data;
struct i2c_adapter *adapter;
struct i2c_client *client;
struct i2c_board_info info;
/* Get the platform and driver data */
pdata = dev_get_platdata(dev);
htcpld = platform_get_drvdata(pdev);
chip = &htcpld->chip[chip_index];
plat_chip_data = &pdata->chip[chip_index];
adapter = i2c_get_adapter(pdata->i2c_adapter_id);
if (!adapter) {
/* Eek, no such I2C adapter! Bail out. */
dev_warn(dev, "Chip at i2c address 0x%x: Invalid i2c adapter %d\n",
plat_chip_data->addr, pdata->i2c_adapter_id);
return -ENODEV;
}
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
dev_warn(dev, "i2c adapter %d non-functional\n",
pdata->i2c_adapter_id);
i2c_put_adapter(adapter);
return -EINVAL;
}
memset(&info, 0, sizeof(struct i2c_board_info));
info.addr = plat_chip_data->addr;
strscpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
info.platform_data = chip;
/* Add the I2C device. This calls the probe() function. */
client = i2c_new_client_device(adapter, &info);
if (IS_ERR(client)) {
/* I2C device registration failed, contineu with the next */
dev_warn(dev, "Unable to add I2C device for 0x%x\n",
plat_chip_data->addr);
i2c_put_adapter(adapter);
return PTR_ERR(client);
}
i2c_set_clientdata(client, chip);
snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%x", client->addr);
chip->client = client;
/* Reset the chip */
htcpld_chip_reset(client);
chip->cache_in = i2c_smbus_read_byte_data(client, chip->cache_out);
return 0;
}
static void htcpld_unregister_chip_i2c(
struct platform_device *pdev,
int chip_index)
{
struct htcpld_data *htcpld;
struct htcpld_chip *chip;
/* Get the platform and driver data */
htcpld = platform_get_drvdata(pdev);
chip = &htcpld->chip[chip_index];
i2c_unregister_device(chip->client);
}
static int htcpld_register_chip_gpio(
struct platform_device *pdev,
int chip_index)
{
struct htcpld_data *htcpld;
struct device *dev = &pdev->dev;
struct htcpld_core_platform_data *pdata;
struct htcpld_chip *chip;
struct htcpld_chip_platform_data *plat_chip_data;
struct gpio_chip *gpio_chip;
int ret = 0;
/* Get the platform and driver data */
pdata = dev_get_platdata(dev);
htcpld = platform_get_drvdata(pdev);
chip = &htcpld->chip[chip_index];
plat_chip_data = &pdata->chip[chip_index];
/* Setup the GPIO chips */
gpio_chip = &(chip->chip_out);
gpio_chip->label = "htcpld-out";
gpio_chip->parent = dev;
gpio_chip->owner = THIS_MODULE;
gpio_chip->get = htcpld_chip_get;
gpio_chip->set = htcpld_chip_set;
gpio_chip->direction_input = NULL;
gpio_chip->direction_output = htcpld_direction_output;
gpio_chip->base = plat_chip_data->gpio_out_base;
gpio_chip->ngpio = plat_chip_data->num_gpios;
gpio_chip = &(chip->chip_in);
gpio_chip->label = "htcpld-in";
gpio_chip->parent = dev;
gpio_chip->owner = THIS_MODULE;
gpio_chip->get = htcpld_chip_get;
gpio_chip->set = NULL;
gpio_chip->direction_input = htcpld_direction_input;
gpio_chip->direction_output = NULL;
gpio_chip->to_irq = htcpld_chip_to_irq;
gpio_chip->base = plat_chip_data->gpio_in_base;
gpio_chip->ngpio = plat_chip_data->num_gpios;
/* Add the GPIO chips */
ret = gpiochip_add_data(&(chip->chip_out), chip);
if (ret) {
dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n",
plat_chip_data->addr, ret);
return ret;
}
ret = gpiochip_add_data(&(chip->chip_in), chip);
if (ret) {
dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
plat_chip_data->addr, ret);
gpiochip_remove(&(chip->chip_out));
return ret;
}
return 0;
}
static int htcpld_setup_chips(struct platform_device *pdev)
{
struct htcpld_data *htcpld;
struct device *dev = &pdev->dev;
struct htcpld_core_platform_data *pdata;
int i;
/* Get the platform and driver data */
pdata = dev_get_platdata(dev);
htcpld = platform_get_drvdata(pdev);
/* Setup each chip's output GPIOs */
htcpld->nchips = pdata->num_chip;
htcpld->chip = devm_kcalloc(dev,
htcpld->nchips,
sizeof(struct htcpld_chip),
GFP_KERNEL);
if (!htcpld->chip)
return -ENOMEM;
/* Add the chips as best we can */
for (i = 0; i < htcpld->nchips; i++) {
int ret;
/* Setup the HTCPLD chips */
htcpld->chip[i].reset = pdata->chip[i].reset;
htcpld->chip[i].cache_out = pdata->chip[i].reset;
htcpld->chip[i].cache_in = 0;
htcpld->chip[i].dev = dev;
htcpld->chip[i].irq_start = pdata->chip[i].irq_base;
htcpld->chip[i].nirqs = pdata->chip[i].num_irqs;
INIT_WORK(&(htcpld->chip[i].set_val_work), &htcpld_chip_set_ni);
spin_lock_init(&(htcpld->chip[i].lock));
/* Setup the interrupts for the chip */
if (htcpld->chained_irq) {
ret = htcpld_setup_chip_irq(pdev, i);
if (ret)
continue;
}
/* Register the chip with I2C */
ret = htcpld_register_chip_i2c(pdev, i);
if (ret)
continue;
/* Register the chips with the GPIO subsystem */
ret = htcpld_register_chip_gpio(pdev, i);
if (ret) {
/* Unregister the chip from i2c and continue */
htcpld_unregister_chip_i2c(pdev, i);
continue;
}
dev_info(dev, "Registered chip at 0x%x\n", pdata->chip[i].addr);
}
return 0;
}
static int htcpld_core_probe(struct platform_device *pdev)
{
struct htcpld_data *htcpld;
struct device *dev = &pdev->dev;
struct htcpld_core_platform_data *pdata;
struct resource *res;
int ret = 0;
if (!dev)
return -ENODEV;
pdata = dev_get_platdata(dev);
if (!pdata) {
dev_warn(dev, "Platform data not found for htcpld core!\n");
return -ENXIO;
}
htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL);
if (!htcpld)
return -ENOMEM;
/* Find chained irq */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res) {
int flags;
htcpld->chained_irq = res->start;
/* Setup the chained interrupt handler */
flags = IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
IRQF_ONESHOT;
ret = request_threaded_irq(htcpld->chained_irq,
NULL, htcpld_handler,
flags, pdev->name, htcpld);
if (ret) {
dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
return ret;
} else
device_init_wakeup(dev, 0);
}
/* Set the driver data */
platform_set_drvdata(pdev, htcpld);
/* Setup the htcpld chips */
ret = htcpld_setup_chips(pdev);
if (ret)
return ret;
/* Request the GPIO(s) for the int reset and set them up */
htcpld->int_reset_gpio_hi = gpiochip_request_own_desc(&htcpld->chip[2].chip_out,
7, "htcpld-core", GPIO_ACTIVE_HIGH,
GPIOD_OUT_HIGH);
if (IS_ERR(htcpld->int_reset_gpio_hi)) {
/*
* If it failed, that sucks, but we can probably
* continue on without it.
*/
htcpld->int_reset_gpio_hi = NULL;
dev_warn(dev, "Unable to request int_reset_gpio_hi -- interrupts may not work\n");
}
htcpld->int_reset_gpio_lo = gpiochip_request_own_desc(&htcpld->chip[2].chip_out,
0, "htcpld-core", GPIO_ACTIVE_HIGH,
GPIOD_OUT_LOW);
if (IS_ERR(htcpld->int_reset_gpio_lo)) {
/*
* If it failed, that sucks, but we can probably
* continue on without it.
*/
htcpld->int_reset_gpio_lo = NULL;
dev_warn(dev, "Unable to request int_reset_gpio_lo -- interrupts may not work\n");
}
dev_info(dev, "Initialized successfully\n");
return 0;
}
/* The I2C Driver -- used internally */
static const struct i2c_device_id htcpld_chip_id[] = {
{ "htcpld-chip", 0 },
{ }
};
static struct i2c_driver htcpld_chip_driver = {
.driver = {
.name = "htcpld-chip",
},
.id_table = htcpld_chip_id,
};
/* The Core Driver */
static struct platform_driver htcpld_core_driver = {
.driver = {
.name = "i2c-htcpld",
},
};
static int __init htcpld_core_init(void)
{
int ret;
/* Register the I2C Chip driver */
ret = i2c_add_driver(&htcpld_chip_driver);
if (ret)
return ret;
/* Probe for our chips */
return platform_driver_probe(&htcpld_core_driver, htcpld_core_probe);
}
device_initcall(htcpld_core_init);

View File

@ -84,8 +84,7 @@ static struct mfd_cell khadas_mcu_cells[] = {
{ .name = "khadas-mcu-user-mem", },
};
static int khadas_mcu_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int khadas_mcu_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct khadas_mcu *ddata;
@ -135,7 +134,7 @@ static struct i2c_driver khadas_mcu_driver = {
.name = "khadas-mcu-core",
.of_match_table = of_match_ptr(khadas_mcu_of_match),
},
.probe = khadas_mcu_probe,
.probe_new = khadas_mcu_probe,
};
module_i2c_driver(khadas_mcu_driver);

View File

@ -584,8 +584,7 @@ static const struct regmap_config regmap_config = {
.precious_reg = lm3533_precious_register,
};
static int lm3533_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int lm3533_i2c_probe(struct i2c_client *i2c)
{
struct lm3533 *lm3533;
@ -627,7 +626,7 @@ static struct i2c_driver lm3533_i2c_driver = {
.name = "lm3533",
},
.id_table = lm3533_i2c_ids,
.probe = lm3533_i2c_probe,
.probe_new = lm3533_i2c_probe,
.remove = lm3533_i2c_remove,
};

View File

@ -102,7 +102,7 @@ static const struct regmap_config lp3943_regmap_config = {
.max_register = LP3943_MAX_REGISTERS,
};
static int lp3943_probe(struct i2c_client *cl, const struct i2c_device_id *id)
static int lp3943_probe(struct i2c_client *cl)
{
struct lp3943 *lp3943;
struct device *dev = &cl->dev;
@ -140,7 +140,7 @@ MODULE_DEVICE_TABLE(of, lp3943_of_match);
#endif
static struct i2c_driver lp3943_driver = {
.probe = lp3943_probe,
.probe_new = lp3943_probe,
.driver = {
.name = "lp3943",
.of_match_table = of_match_ptr(lp3943_of_match),

View File

@ -24,8 +24,7 @@ static const struct mfd_cell lp873x_cells[] = {
{ .name = "lp873x-gpio", },
};
static int lp873x_probe(struct i2c_client *client,
const struct i2c_device_id *ids)
static int lp873x_probe(struct i2c_client *client)
{
struct lp873x *lp873;
int ret;
@ -79,7 +78,7 @@ static struct i2c_driver lp873x_driver = {
.name = "lp873x",
.of_match_table = of_lp873x_match_table,
},
.probe = lp873x_probe,
.probe_new = lp873x_probe,
.id_table = lp873x_id_table,
};
module_i2c_driver(lp873x_driver);

View File

@ -43,8 +43,7 @@ static const struct of_device_id of_lp87565_match_table[] = {
};
MODULE_DEVICE_TABLE(of, of_lp87565_match_table);
static int lp87565_probe(struct i2c_client *client,
const struct i2c_device_id *ids)
static int lp87565_probe(struct i2c_client *client)
{
struct lp87565 *lp87565;
const struct of_device_id *of_id;
@ -120,7 +119,7 @@ static struct i2c_driver lp87565_driver = {
.name = "lp87565",
.of_match_table = of_lp87565_match_table,
},
.probe = lp87565_probe,
.probe_new = lp87565_probe,
.shutdown = lp87565_shutdown,
.id_table = lp87565_id_table,
};

View File

@ -166,7 +166,7 @@ static const struct regmap_config lp8788_regmap_config = {
.max_register = MAX_LP8788_REGISTERS,
};
static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)
static int lp8788_probe(struct i2c_client *cl)
{
struct lp8788 *lp;
struct lp8788_platform_data *pdata = dev_get_platdata(&cl->dev);
@ -225,7 +225,7 @@ static struct i2c_driver lp8788_driver = {
.driver = {
.name = "lp8788",
},
.probe = lp8788_probe,
.probe_new = lp8788_probe,
.remove = lp8788_remove,
.id_table = lp8788_ids,
};

View File

@ -8,13 +8,12 @@
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>

View File

@ -17,9 +17,9 @@
#include "madera.h"
static int madera_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int madera_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct madera *madera;
const struct regmap_config *regmap_16bit_config = NULL;
const struct regmap_config *regmap_32bit_config = NULL;
@ -139,7 +139,7 @@ static struct i2c_driver madera_i2c_driver = {
.pm = &madera_pm_ops,
.of_match_table = of_match_ptr(madera_of_match),
},
.probe = madera_i2c_probe,
.probe_new = madera_i2c_probe,
.remove = madera_i2c_remove,
.id_table = madera_i2c_id,
};

View File

@ -209,8 +209,7 @@ static const struct regmap_irq max14577_irqs[] = {
static const struct regmap_irq_chip max14577_irq_chip = {
.name = "max14577",
.status_base = MAX14577_REG_INT1,
.mask_base = MAX14577_REG_INTMASK1,
.mask_invert = true,
.unmask_base = MAX14577_REG_INTMASK1,
.num_regs = 3,
.irqs = max14577_irqs,
.num_irqs = ARRAY_SIZE(max14577_irqs),
@ -239,8 +238,7 @@ static const struct regmap_irq max77836_muic_irqs[] = {
static const struct regmap_irq_chip max77836_muic_irq_chip = {
.name = "max77836-muic",
.status_base = MAX14577_REG_INT1,
.mask_base = MAX14577_REG_INTMASK1,
.mask_invert = true,
.unmask_base = MAX14577_REG_INTMASK1,
.num_regs = 3,
.irqs = max77836_muic_irqs,
.num_irqs = ARRAY_SIZE(max77836_muic_irqs),
@ -255,7 +253,6 @@ static const struct regmap_irq_chip max77836_pmic_irq_chip = {
.name = "max77836-pmic",
.status_base = MAX77836_PMIC_REG_TOPSYS_INT,
.mask_base = MAX77836_PMIC_REG_TOPSYS_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77836_pmic_irqs,
.num_irqs = ARRAY_SIZE(max77836_pmic_irqs),
@ -358,9 +355,9 @@ static void max77836_remove(struct max14577 *max14577)
i2c_unregister_device(max14577->i2c_pmic);
}
static int max14577_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max14577_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct max14577 *max14577;
struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct device_node *np = i2c->dev.of_node;
@ -480,7 +477,6 @@ static const struct i2c_device_id max14577_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
#ifdef CONFIG_PM_SLEEP
static int max14577_suspend(struct device *dev)
{
struct i2c_client *i2c = to_i2c_client(dev);
@ -513,17 +509,16 @@ static int max14577_resume(struct device *dev)
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume);
static struct i2c_driver max14577_i2c_driver = {
.driver = {
.name = "max14577",
.pm = &max14577_pm,
.pm = pm_sleep_ptr(&max14577_pm),
.of_match_table = max14577_dt_match,
},
.probe = max14577_i2c_probe,
.probe_new = max14577_i2c_probe,
.remove = max14577_i2c_remove,
.id_table = max14577_i2c_id,
};

View File

@ -494,9 +494,9 @@ static void max77620_pm_power_off(void)
MAX77620_ONOFFCNFG1_SFT_RST);
}
static int max77620_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int max77620_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
const struct regmap_config *rmap_config;
struct max77620_chip *chip;
const struct mfd_cell *mfd_cells;
@ -576,7 +576,6 @@ static int max77620_probe(struct i2c_client *client,
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int max77620_set_fps_period(struct max77620_chip *chip,
int fps_id, int time_period)
{
@ -683,7 +682,6 @@ out:
return 0;
}
#endif
static const struct i2c_device_id max77620_id[] = {
{"max77620", MAX77620},
@ -692,16 +690,15 @@ static const struct i2c_device_id max77620_id[] = {
{},
};
static const struct dev_pm_ops max77620_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume)
};
static DEFINE_SIMPLE_DEV_PM_OPS(max77620_pm_ops,
max77620_i2c_suspend, max77620_i2c_resume);
static struct i2c_driver max77620_driver = {
.driver = {
.name = "max77620",
.pm = &max77620_pm_ops,
.pm = pm_sleep_ptr(&max77620_pm_ops),
},
.probe = max77620_probe,
.probe_new = max77620_probe,
.id_table = max77620_id,
};
builtin_i2c_driver(max77620_driver);

View File

@ -138,7 +138,6 @@ static const struct regmap_irq_chip max77650_irq_chip = {
.status_base = MAX77650_REG_INT_GLBL,
.mask_base = MAX77650_REG_INTM_GLBL,
.type_in_mask = true,
.type_invert = true,
.init_ack_masked = true,
.clear_on_unmask = true,
};

View File

@ -226,7 +226,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int max77686_suspend(struct device *dev)
{
struct i2c_client *i2c = to_i2c_client(dev);
@ -261,14 +260,13 @@ static int max77686_resume(struct device *dev)
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume);
static struct i2c_driver max77686_i2c_driver = {
.driver = {
.name = "max77686",
.pm = &max77686_pm,
.pm = pm_sleep_ptr(&max77686_pm),
.of_match_table = max77686_pmic_dt_match,
},
.probe_new = max77686_i2c_probe,

View File

@ -66,7 +66,6 @@ static const struct regmap_irq_chip max77693_led_irq_chip = {
.name = "max77693-led",
.status_base = MAX77693_LED_REG_FLASH_INT,
.mask_base = MAX77693_LED_REG_FLASH_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_led_irqs,
.num_irqs = ARRAY_SIZE(max77693_led_irqs),
@ -82,7 +81,6 @@ static const struct regmap_irq_chip max77693_topsys_irq_chip = {
.name = "max77693-topsys",
.status_base = MAX77693_PMIC_REG_TOPSYS_INT,
.mask_base = MAX77693_PMIC_REG_TOPSYS_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_topsys_irqs,
.num_irqs = ARRAY_SIZE(max77693_topsys_irqs),
@ -100,7 +98,6 @@ static const struct regmap_irq_chip max77693_charger_irq_chip = {
.name = "max77693-charger",
.status_base = MAX77693_CHG_REG_CHG_INT,
.mask_base = MAX77693_CHG_REG_CHG_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_charger_irqs,
.num_irqs = ARRAY_SIZE(max77693_charger_irqs),
@ -136,8 +133,7 @@ static const struct regmap_irq max77693_muic_irqs[] = {
static const struct regmap_irq_chip max77693_muic_irq_chip = {
.name = "max77693-muic",
.status_base = MAX77693_MUIC_REG_INT1,
.mask_base = MAX77693_MUIC_REG_INTMASK1,
.mask_invert = true,
.unmask_base = MAX77693_MUIC_REG_INTMASK1,
.num_regs = 3,
.irqs = max77693_muic_irqs,
.num_irqs = ARRAY_SIZE(max77693_muic_irqs),
@ -149,9 +145,9 @@ static const struct regmap_config max77693_regmap_haptic_config = {
.max_register = MAX77693_HAPTIC_REG_END,
};
static int max77693_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max77693_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct max77693_dev *max77693;
unsigned int reg_data;
int ret = 0;
@ -360,7 +356,7 @@ static struct i2c_driver max77693_i2c_driver = {
.pm = &max77693_pm,
.of_match_table = of_match_ptr(max77693_dt_match),
},
.probe = max77693_i2c_probe,
.probe_new = max77693_i2c_probe,
.remove = max77693_i2c_remove,
.id_table = max77693_i2c_id,
};

View File

@ -59,7 +59,6 @@ static const struct regmap_irq_chip max77843_irq_chip = {
.name = "max77843",
.status_base = MAX77843_SYS_REG_SYSINTSRC,
.mask_base = MAX77843_SYS_REG_SYSINTMASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77843_irqs,
.num_irqs = ARRAY_SIZE(max77843_irqs),
@ -93,9 +92,9 @@ err_chg_i2c:
return ret;
}
static int max77843_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max77843_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct max77693_dev *max77843;
unsigned int reg_data;
int ret;
@ -208,7 +207,7 @@ static struct i2c_driver max77843_i2c_driver = {
.of_match_table = max77843_dt_match,
.suppress_bind_attrs = true,
},
.probe = max77843_probe,
.probe_new = max77843_probe,
.id_table = max77843_id,
};

View File

@ -181,8 +181,7 @@ static void max8907_power_off(void)
MAX8907_MASK_POWER_OFF, MAX8907_MASK_POWER_OFF);
}
static int max8907_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max8907_i2c_probe(struct i2c_client *i2c)
{
struct max8907 *max8907;
int ret;
@ -314,7 +313,7 @@ static struct i2c_driver max8907_i2c_driver = {
.name = "max8907",
.of_match_table = of_match_ptr(max8907_of_match),
},
.probe = max8907_i2c_probe,
.probe_new = max8907_i2c_probe,
.remove = max8907_i2c_remove,
.id_table = max8907_i2c_id,
};

View File

@ -144,8 +144,7 @@ static int max8925_dt_init(struct device_node *np, struct device *dev,
return 0;
}
static int max8925_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int max8925_probe(struct i2c_client *client)
{
struct max8925_platform_data *pdata = dev_get_platdata(&client->dev);
struct max8925_chip *chip;
@ -207,7 +206,6 @@ static void max8925_remove(struct i2c_client *client)
i2c_unregister_device(chip->rtc);
}
#ifdef CONFIG_PM_SLEEP
static int max8925_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@ -227,9 +225,9 @@ static int max8925_resume(struct device *dev)
disable_irq_wake(chip->core_irq);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops,
max8925_suspend, max8925_resume);
static const struct of_device_id max8925_dt_ids[] = {
{ .compatible = "maxim,max8925", },
@ -239,10 +237,10 @@ static const struct of_device_id max8925_dt_ids[] = {
static struct i2c_driver max8925_driver = {
.driver = {
.name = "max8925",
.pm = &max8925_pm_ops,
.pm = pm_sleep_ptr(&max8925_pm_ops),
.of_match_table = max8925_dt_ids,
},
.probe = max8925_probe,
.probe_new = max8925_probe,
.remove = max8925_remove,
.id_table = max8925_id_table,
};

View File

@ -152,9 +152,9 @@ static inline unsigned long max8997_i2c_get_driver_data(struct i2c_client *i2c,
return id->driver_data;
}
static int max8997_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max8997_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct max8997_dev *max8997;
struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev);
int ret = 0;
@ -478,7 +478,7 @@ static struct i2c_driver max8997_i2c_driver = {
.suppress_bind_attrs = true,
.of_match_table = of_match_ptr(max8997_pmic_dt_match),
},
.probe = max8997_i2c_probe,
.probe_new = max8997_i2c_probe,
.id_table = max8997_i2c_id,
};

View File

@ -162,9 +162,9 @@ static inline unsigned long max8998_i2c_get_driver_data(struct i2c_client *i2c,
return id->driver_data;
}
static int max8998_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int max8998_i2c_probe(struct i2c_client *i2c)
{
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev);
struct max8998_dev *max8998;
int ret = 0;
@ -348,7 +348,7 @@ static struct i2c_driver max8998_i2c_driver = {
.suppress_bind_attrs = true,
.of_match_table = of_match_ptr(max8998_dt_match),
},
.probe = max8998_i2c_probe,
.probe_new = max8998_i2c_probe,
.id_table = max8998_i2c_id,
};

View File

@ -11,7 +11,6 @@
#include <linux/mfd/mc13xxx.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/i2c.h>
#include <linux/err.h>
@ -52,9 +51,9 @@ static const struct regmap_config mc13xxx_regmap_i2c_config = {
.cache_type = REGCACHE_NONE,
};
static int mc13xxx_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int mc13xxx_i2c_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct mc13xxx *mc13xxx;
int ret;
@ -96,7 +95,7 @@ static struct i2c_driver mc13xxx_i2c_driver = {
.name = "mc13xxx",
.of_match_table = mc13xxx_dt_ids,
},
.probe = mc13xxx_i2c_probe,
.probe_new = mc13xxx_i2c_probe,
.remove = mc13xxx_i2c_remove,
};

View File

@ -15,7 +15,6 @@
#include <linux/mfd/mc13xxx.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/err.h>
#include <linux/spi/spi.h>
@ -115,7 +114,7 @@ static int mc13xxx_spi_write(void *context, const void *data, size_t count)
* result, the SS will negate before all of the data has been
* transferred to/from the peripheral."
* We workaround this by accessing the SPI controller with a
* single transfert.
* single transfer.
*/
static struct regmap_bus regmap_mc13xxx_bus = {

View File

@ -255,7 +255,6 @@ static int mcp_sa11x0_remove(struct platform_device *dev)
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int mcp_sa11x0_suspend(struct device *dev)
{
struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev));
@ -277,17 +276,14 @@ static int mcp_sa11x0_resume(struct device *dev)
return 0;
}
#endif
static const struct dev_pm_ops mcp_sa11x0_pm_ops = {
#ifdef CONFIG_PM_SLEEP
.suspend = mcp_sa11x0_suspend,
.freeze = mcp_sa11x0_suspend,
.poweroff = mcp_sa11x0_suspend,
.resume_noirq = mcp_sa11x0_resume,
.thaw_noirq = mcp_sa11x0_resume,
.restore_noirq = mcp_sa11x0_resume,
#endif
};
static struct platform_driver mcp_sa11x0_driver = {
@ -295,7 +291,7 @@ static struct platform_driver mcp_sa11x0_driver = {
.remove = mcp_sa11x0_remove,
.driver = {
.name = DRIVER_NAME,
.pm = &mcp_sa11x0_pm_ops,
.pm = pm_sleep_ptr(&mcp_sa11x0_pm_ops),
},
};

View File

@ -1142,8 +1142,7 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m)
static struct i2c_driver menelaus_i2c_driver;
static int menelaus_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int menelaus_probe(struct i2c_client *client)
{
struct menelaus_chip *menelaus;
int rev = 0;
@ -1241,7 +1240,7 @@ static struct i2c_driver menelaus_i2c_driver = {
.driver = {
.name = DRIVER_NAME,
},
.probe = menelaus_probe,
.probe_new = menelaus_probe,
.remove = menelaus_remove,
.id_table = menelaus_id,
};

View File

@ -49,7 +49,7 @@ static int menf21bmc_wdt_exit_prod_mode(struct i2c_client *client)
}
static int
menf21bmc_probe(struct i2c_client *client, const struct i2c_device_id *ids)
menf21bmc_probe(struct i2c_client *client)
{
int rev_major, rev_minor, rev_main;
int ret;
@ -111,7 +111,7 @@ MODULE_DEVICE_TABLE(i2c, menf21bmc_id_table);
static struct i2c_driver menf21bmc_driver = {
.driver.name = "menf21bmc",
.id_table = menf21bmc_id_table,
.probe = menf21bmc_probe,
.probe_new = menf21bmc_probe,
};
module_i2c_driver(menf21bmc_driver);

View File

@ -221,7 +221,6 @@ static const struct regmap_config cpcap_regmap_config = {
.val_format_endian = REGMAP_ENDIAN_LITTLE,
};
#ifdef CONFIG_PM_SLEEP
static int cpcap_suspend(struct device *dev)
{
struct spi_device *spi = to_spi_device(dev);
@ -239,9 +238,8 @@ static int cpcap_resume(struct device *dev)
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume);
static const struct mfd_cell cpcap_mfd_devices[] = {
{
@ -296,7 +294,7 @@ static int cpcap_probe(struct spi_device *spi)
struct cpcap_ddata *cpcap;
int ret;
match = of_match_device(of_match_ptr(cpcap_of_match), &spi->dev);
match = of_match_device(cpcap_of_match, &spi->dev);
if (!match)
return -ENODEV;
@ -346,7 +344,7 @@ static struct spi_driver cpcap_driver = {
.driver = {
.name = "cpcap-core",
.of_match_table = cpcap_of_match,
.pm = &cpcap_pm,
.pm = pm_sleep_ptr(&cpcap_pm),
},
.probe = cpcap_probe,
.id_table = cpcap_spi_ids,

View File

@ -402,7 +402,7 @@ static int mt6360_regmap_read(void *context, const void *reg, size_t reg_size,
struct mt6360_ddata *ddata = context;
u8 bank = *(u8 *)reg;
u8 reg_addr = *(u8 *)(reg + 1);
struct i2c_client *i2c = ddata->i2c[bank];
struct i2c_client *i2c;
bool crc_needed = false;
u8 *buf;
int buf_len = MT6360_ALLOC_READ_SIZE(val_size);
@ -410,6 +410,11 @@ static int mt6360_regmap_read(void *context, const void *reg, size_t reg_size,
u8 crc;
int ret;
if (bank >= MT6360_SLAVE_MAX)
return -EINVAL;
i2c = ddata->i2c[bank];
if (bank == MT6360_SLAVE_PMIC || bank == MT6360_SLAVE_LDO) {
crc_needed = true;
ret = mt6360_xlate_pmicldo_addr(&reg_addr, val_size);
@ -453,13 +458,18 @@ static int mt6360_regmap_write(void *context, const void *val, size_t val_size)
struct mt6360_ddata *ddata = context;
u8 bank = *(u8 *)val;
u8 reg_addr = *(u8 *)(val + 1);
struct i2c_client *i2c = ddata->i2c[bank];
struct i2c_client *i2c;
bool crc_needed = false;
u8 *buf;
int buf_len = MT6360_ALLOC_WRITE_SIZE(val_size);
int write_size = val_size - MT6360_REGMAP_REG_BYTE_SIZE;
int ret;
if (bank >= MT6360_SLAVE_MAX)
return -EINVAL;
i2c = ddata->i2c[bank];
if (bank == MT6360_SLAVE_PMIC || bank == MT6360_SLAVE_LDO) {
crc_needed = true;
ret = mt6360_xlate_pmicldo_addr(&reg_addr, val_size - MT6360_REGMAP_REG_BYTE_SIZE);

View File

@ -54,7 +54,6 @@ static void mt6397_irq_enable(struct irq_data *data)
mt6397->irq_masks_cur[reg] |= BIT(shift);
}
#ifdef CONFIG_PM_SLEEP
static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
{
struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data);
@ -68,9 +67,6 @@ static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on)
return 0;
}
#else
#define mt6397_irq_set_wake NULL
#endif
static struct irq_chip mt6397_irq_chip = {
.name = "mt6397-irq",
@ -78,7 +74,7 @@ static struct irq_chip mt6397_irq_chip = {
.irq_bus_sync_unlock = mt6397_irq_sync_unlock,
.irq_enable = mt6397_irq_enable,
.irq_disable = mt6397_irq_disable,
.irq_set_wake = mt6397_irq_set_wake,
.irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake),
};
static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg,

View File

@ -502,8 +502,7 @@ static const struct of_device_id of_palmas_match_tbl[] = {
};
MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
static int palmas_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int palmas_i2c_probe(struct i2c_client *i2c)
{
struct palmas *palmas;
struct palmas_platform_data *pdata;
@ -512,7 +511,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
int ret = 0, i;
unsigned int reg, addr;
int slave;
const struct of_device_id *match;
pdata = dev_get_platdata(&i2c->dev);
@ -536,12 +534,7 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
palmas->dev = &i2c->dev;
palmas->irq = i2c->irq;
match = of_match_device(of_palmas_match_tbl, &i2c->dev);
if (!match)
return -ENODATA;
driver_data = (struct palmas_driver_data *)match->data;
driver_data = (struct palmas_driver_data *) device_get_match_data(&i2c->dev);
palmas->features = *driver_data->features;
for (i = 0; i < PALMAS_NUM_CLIENTS; i++) {
@ -732,7 +725,7 @@ static struct i2c_driver palmas_i2c_driver = {
.name = "palmas",
.of_match_table = of_palmas_match_tbl,
},
.probe = palmas_i2c_probe,
.probe_new = palmas_i2c_probe,
.remove = palmas_i2c_remove,
.id_table = palmas_i2c_id,
};

View File

@ -158,33 +158,12 @@ pcf50633_client_dev_register(struct pcf50633 *pcf, const char *name,
}
}
#ifdef CONFIG_PM_SLEEP
static int pcf50633_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct pcf50633 *pcf = i2c_get_clientdata(client);
return pcf50633_irq_suspend(pcf);
}
static int pcf50633_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct pcf50633 *pcf = i2c_get_clientdata(client);
return pcf50633_irq_resume(pcf);
}
#endif
static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
static const struct regmap_config pcf50633_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
};
static int pcf50633_probe(struct i2c_client *client,
const struct i2c_device_id *ids)
static int pcf50633_probe(struct i2c_client *client)
{
struct pcf50633 *pcf;
struct platform_device *pdev;
@ -300,10 +279,10 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table);
static struct i2c_driver pcf50633_driver = {
.driver = {
.name = "pcf50633",
.pm = &pcf50633_pm,
.pm = pm_sleep_ptr(&pcf50633_pm),
},
.id_table = pcf50633_id_table,
.probe = pcf50633_probe,
.probe_new = pcf50633_probe,
.remove = pcf50633_remove,
};

View File

@ -7,6 +7,7 @@
* All rights reserved.
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
@ -218,10 +219,10 @@ out:
return IRQ_HANDLED;
}
#ifdef CONFIG_PM
int pcf50633_irq_suspend(struct pcf50633 *pcf)
static int pcf50633_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct pcf50633 *pcf = i2c_get_clientdata(client);
int ret;
int i;
u8 res[5];
@ -257,8 +258,10 @@ out:
return ret;
}
int pcf50633_irq_resume(struct pcf50633 *pcf)
static int pcf50633_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct pcf50633 *pcf = i2c_get_clientdata(client);
int ret;
/* Write the saved mask registers */
@ -273,7 +276,7 @@ int pcf50633_irq_resume(struct pcf50633 *pcf)
return ret;
}
#endif
EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume);
int pcf50633_irq_init(struct pcf50633 *pcf, int irq)
{

View File

@ -215,8 +215,8 @@ static int pm8008_probe(struct i2c_client *client)
dev = &client->dev;
regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg);
if (!regmap)
return -ENODEV;
if (IS_ERR(regmap))
return PTR_ERR(regmap);
i2c_set_clientdata(client, regmap);

View File

@ -497,7 +497,6 @@ static const struct pm_irq_data pm8821_data = {
};
static const struct of_device_id pm8xxx_id_table[] = {
{ .compatible = "qcom,pm8018", .data = &pm8xxx_data},
{ .compatible = "qcom,pm8058", .data = &pm8xxx_data},
{ .compatible = "qcom,pm8821", .data = &pm8821_data},
{ .compatible = "qcom,pm8921", .data = &pm8xxx_data},

View File

@ -547,7 +547,7 @@ static int qcom_rpm_probe(struct platform_device *pdev)
init_completion(&rpm->ack);
/* Enable message RAM clock */
rpm->ramclk = devm_clk_get(&pdev->dev, "ram");
rpm->ramclk = devm_clk_get_enabled(&pdev->dev, "ram");
if (IS_ERR(rpm->ramclk)) {
ret = PTR_ERR(rpm->ramclk);
if (ret == -EPROBE_DEFER)
@ -558,7 +558,6 @@ static int qcom_rpm_probe(struct platform_device *pdev)
*/
rpm->ramclk = NULL;
}
clk_prepare_enable(rpm->ramclk); /* Accepts NULL */
irq_ack = platform_get_irq_byname(pdev, "ack");
if (irq_ack < 0)
@ -673,22 +672,11 @@ static int qcom_rpm_probe(struct platform_device *pdev)
if (ret)
dev_warn(&pdev->dev, "failed to mark wakeup irq as wakeup\n");
return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
}
static int qcom_rpm_remove(struct platform_device *pdev)
{
struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev);
of_platform_depopulate(&pdev->dev);
clk_disable_unprepare(rpm->ramclk);
return 0;
return devm_of_platform_populate(&pdev->dev);
}
static struct platform_driver qcom_rpm_driver = {
.probe = qcom_rpm_probe,
.remove = qcom_rpm_remove,
.driver = {
.name = "qcom_rpm",
.of_match_table = qcom_rpm_of_match,

View File

@ -228,15 +228,12 @@ static void rc5t583_irq_sync_unlock(struct irq_data *irq_data)
mutex_unlock(&rc5t583->irq_lock);
}
#ifdef CONFIG_PM_SLEEP
static int rc5t583_irq_set_wake(struct irq_data *irq_data, unsigned int on)
{
struct rc5t583 *rc5t583 = irq_data_get_irq_chip_data(irq_data);
return irq_set_irq_wake(rc5t583->chip_irq, on);
}
#else
#define rc5t583_irq_set_wake NULL
#endif
static irqreturn_t rc5t583_irq(int irq, void *data)
{
@ -317,7 +314,7 @@ static struct irq_chip rc5t583_irq_chip = {
.irq_bus_lock = rc5t583_irq_lock,
.irq_bus_sync_unlock = rc5t583_irq_sync_unlock,
.irq_set_type = rc5t583_irq_set_type,
.irq_set_wake = rc5t583_irq_set_wake,
.irq_set_wake = pm_sleep_ptr(rc5t583_irq_set_wake),
};
int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base)

View File

@ -233,8 +233,7 @@ static const struct regmap_config rc5t583_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
static int rc5t583_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int rc5t583_i2c_probe(struct i2c_client *i2c)
{
struct rc5t583 *rc5t583;
struct rc5t583_platform_data *pdata = dev_get_platdata(&i2c->dev);
@ -289,7 +288,7 @@ static struct i2c_driver rc5t583_i2c_driver = {
.driver = {
.name = "rc5t583",
},
.probe = rc5t583_i2c_probe,
.probe_new = rc5t583_i2c_probe,
.id_table = rc5t583_i2c_id,
};

View File

@ -227,7 +227,7 @@ static const struct regmap_config retu_config = {
.val_bits = 16,
};
static int retu_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
static int retu_probe(struct i2c_client *i2c)
{
struct retu_data const *rdat;
struct retu_dev *rdev;
@ -318,7 +318,7 @@ static struct i2c_driver retu_driver = {
.name = "retu-mfd",
.of_match_table = retu_of_match,
},
.probe = retu_probe,
.probe_new = retu_probe,
.remove = retu_remove,
.id_table = retu_id,
};

View File

@ -137,58 +137,64 @@ static const struct resource rk817_charger_resources[] = {
};
static const struct mfd_cell rk805s[] = {
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
{ .name = "rk805-pinctrl", },
{ .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, },
{ .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, },
{ .name = "rk805-pinctrl", .id = PLATFORM_DEVID_NONE, },
{
.name = "rk808-rtc",
.num_resources = ARRAY_SIZE(rtc_resources),
.resources = &rtc_resources[0],
.id = PLATFORM_DEVID_NONE,
},
{ .name = "rk805-pwrkey",
.num_resources = ARRAY_SIZE(rk805_key_resources),
.resources = &rk805_key_resources[0],
.id = PLATFORM_DEVID_NONE,
},
};
static const struct mfd_cell rk808s[] = {
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
{ .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, },
{ .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, },
{
.name = "rk808-rtc",
.num_resources = ARRAY_SIZE(rtc_resources),
.resources = rtc_resources,
.id = PLATFORM_DEVID_NONE,
},
};
static const struct mfd_cell rk817s[] = {
{ .name = "rk808-clkout",},
{ .name = "rk808-regulator",},
{ .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, },
{ .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, },
{
.name = "rk805-pwrkey",
.num_resources = ARRAY_SIZE(rk817_pwrkey_resources),
.resources = &rk817_pwrkey_resources[0],
.id = PLATFORM_DEVID_NONE,
},
{
.name = "rk808-rtc",
.num_resources = ARRAY_SIZE(rk817_rtc_resources),
.resources = &rk817_rtc_resources[0],
.id = PLATFORM_DEVID_NONE,
},
{ .name = "rk817-codec",},
{ .name = "rk817-codec", .id = PLATFORM_DEVID_NONE, },
{
.name = "rk817-charger",
.num_resources = ARRAY_SIZE(rk817_charger_resources),
.resources = &rk817_charger_resources[0],
.id = PLATFORM_DEVID_NONE,
},
};
static const struct mfd_cell rk818s[] = {
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
{ .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, },
{
.name = "rk808-rtc",
.num_resources = ARRAY_SIZE(rtc_resources),
.resources = rtc_resources,
.id = PLATFORM_DEVID_NONE,
},
};
@ -640,8 +646,7 @@ static const struct of_device_id rk808_of_match[] = {
};
MODULE_DEVICE_TABLE(of, rk808_of_match);
static int rk808_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int rk808_probe(struct i2c_client *client)
{
struct device_node *np = client->dev.of_node;
struct rk808 *rk808;
@ -861,7 +866,7 @@ static struct i2c_driver rk808_i2c_driver = {
.of_match_table = rk808_of_match,
.pm = &rk8xx_pm_ops,
},
.probe = rk808_probe,
.probe_new = rk808_probe,
.remove = rk808_remove,
.shutdown = rk8xx_shutdown,
};

View File

@ -80,8 +80,7 @@ static const struct regmap_irq_chip rc5t619_irq_chip = {
.num_irqs = ARRAY_SIZE(rc5t619_irqs),
.num_regs = 1,
.status_base = RN5T618_INTMON,
.mask_base = RN5T618_INTEN,
.mask_invert = true,
.unmask_base = RN5T618_INTEN,
};
static struct i2c_client *rn5t618_pm_power_off;

View File

@ -413,9 +413,8 @@ static struct regmap_irq_chip bd71828_irq_chip = {
.irqs = &bd71828_irqs[0],
.num_irqs = ARRAY_SIZE(bd71828_irqs),
.status_base = BD71828_REG_INT_BUCK,
.mask_base = BD71828_REG_INT_MASK_BUCK,
.unmask_base = BD71828_REG_INT_MASK_BUCK,
.ack_base = BD71828_REG_INT_BUCK,
.mask_invert = true,
.init_ack_masked = true,
.num_regs = 12,
.num_main_regs = 1,
@ -430,9 +429,8 @@ static struct regmap_irq_chip bd71815_irq_chip = {
.irqs = &bd71815_irqs[0],
.num_irqs = ARRAY_SIZE(bd71815_irqs),
.status_base = BD71815_REG_INT_STAT_01,
.mask_base = BD71815_REG_INT_EN_01,
.unmask_base = BD71815_REG_INT_EN_01,
.ack_base = BD71815_REG_INT_STAT_01,
.mask_invert = true,
.init_ack_masked = true,
.num_regs = 12,
.num_main_regs = 1,
@ -515,27 +513,24 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
}
regmap = devm_regmap_init_i2c(i2c, regmap_config);
if (IS_ERR(regmap)) {
dev_err(&i2c->dev, "Failed to initialize Regmap\n");
return PTR_ERR(regmap);
}
if (IS_ERR(regmap))
return dev_err_probe(&i2c->dev, PTR_ERR(regmap),
"Failed to initialize Regmap\n");
ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq,
IRQF_ONESHOT, 0, irqchip, &irq_data);
if (ret) {
dev_err(&i2c->dev, "Failed to add IRQ chip\n");
return ret;
}
if (ret)
return dev_err_probe(&i2c->dev, ret,
"Failed to add IRQ chip\n");
dev_dbg(&i2c->dev, "Registered %d IRQs for chip\n",
irqchip->num_irqs);
if (button_irq) {
ret = regmap_irq_get_virq(irq_data, button_irq);
if (ret < 0) {
dev_err(&i2c->dev, "Failed to get the power-key IRQ\n");
return ret;
}
if (ret < 0)
return dev_err_probe(&i2c->dev, ret,
"Failed to get the power-key IRQ\n");
button.irq = ret;
}
@ -547,7 +542,7 @@ static int bd71828_i2c_probe(struct i2c_client *i2c)
ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, mfd, cells,
NULL, 0, regmap_irq_get_domain(irq_data));
if (ret)
dev_err(&i2c->dev, "Failed to create subdevices\n");
dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
return ret;
}

View File

@ -70,7 +70,6 @@ static struct regmap_irq_chip bd718xx_irq_chip = {
.mask_base = BD718XX_REG_MIRQ,
.ack_base = BD718XX_REG_IRQ,
.init_ack_masked = true,
.mask_invert = false,
};
static const struct regmap_range pmic_status_range = {
@ -127,8 +126,7 @@ static int bd718xx_init_press_duration(struct regmap *regmap,
return 0;
}
static int bd718xx_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int bd718xx_i2c_probe(struct i2c_client *i2c)
{
struct regmap *regmap;
struct regmap_irq_chip_data *irq_data;
@ -158,18 +156,15 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
}
regmap = devm_regmap_init_i2c(i2c, &bd718xx_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&i2c->dev, "regmap initialization failed\n");
return PTR_ERR(regmap);
}
if (IS_ERR(regmap))
return dev_err_probe(&i2c->dev, PTR_ERR(regmap),
"regmap initialization failed\n");
ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq,
IRQF_ONESHOT, 0, &bd718xx_irq_chip,
&irq_data);
if (ret) {
dev_err(&i2c->dev, "Failed to add irq_chip\n");
return ret;
}
if (ret)
return dev_err_probe(&i2c->dev, ret, "Failed to add irq_chip\n");
ret = bd718xx_init_press_duration(regmap, &i2c->dev);
if (ret)
@ -177,10 +172,8 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
ret = regmap_irq_get_virq(irq_data, BD718XX_INT_PWRBTN_S);
if (ret < 0) {
dev_err(&i2c->dev, "Failed to get the IRQ\n");
return ret;
}
if (ret < 0)
return dev_err_probe(&i2c->dev, ret, "Failed to get the IRQ\n");
button.irq = ret;
@ -188,7 +181,7 @@ static int bd718xx_i2c_probe(struct i2c_client *i2c,
mfd, cells, NULL, 0,
regmap_irq_get_domain(irq_data));
if (ret)
dev_err(&i2c->dev, "Failed to create subdevices\n");
dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
return ret;
}
@ -215,7 +208,7 @@ static struct i2c_driver bd718xx_i2c_driver = {
.name = "rohm-bd718x7",
.of_match_table = bd718xx_of_match,
},
.probe = bd718xx_i2c_probe,
.probe_new = bd718xx_i2c_probe,
};
static int __init bd718xx_i2c_init(void)

View File

@ -88,8 +88,7 @@ static struct regmap_irq_chip bd9576_irq_chip = {
.irq_reg_stride = 1,
};
static int bd957x_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
static int bd957x_i2c_probe(struct i2c_client *i2c)
{
int ret;
struct regmap *regmap;
@ -122,10 +121,9 @@ static int bd957x_i2c_probe(struct i2c_client *i2c,
}
regmap = devm_regmap_init_i2c(i2c, &bd957x_regmap);
if (IS_ERR(regmap)) {
dev_err(&i2c->dev, "Failed to initialize Regmap\n");
return PTR_ERR(regmap);
}
if (IS_ERR(regmap))
return dev_err_probe(&i2c->dev, PTR_ERR(regmap),
"Failed to initialize Regmap\n");
/*
* BD9576 behaves badly. It kepts IRQ line asserted for the whole
@ -146,10 +144,10 @@ static int bd957x_i2c_probe(struct i2c_client *i2c,
ret = devm_regmap_add_irq_chip(&i2c->dev, regmap, i2c->irq,
IRQF_ONESHOT, 0,
&bd9576_irq_chip, &irq_data);
if (ret) {
dev_err(&i2c->dev, "Failed to add IRQ chip\n");
return ret;
}
if (ret)
return dev_err_probe(&i2c->dev, ret,
"Failed to add IRQ chip\n");
domain = regmap_irq_get_domain(irq_data);
} else {
ret = regmap_update_bits(regmap, BD957X_REG_INT_MAIN_MASK,
@ -163,7 +161,7 @@ static int bd957x_i2c_probe(struct i2c_client *i2c,
ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, cells,
num_cells, NULL, 0, domain);
if (ret)
dev_err(&i2c->dev, "Failed to create subdevices\n");
dev_err_probe(&i2c->dev, ret, "Failed to create subdevices\n");
return ret;
}
@ -180,7 +178,7 @@ static struct i2c_driver bd957x_drv = {
.name = "rohm-bd957x",
.of_match_table = bd957x_of_match,
},
.probe = &bd957x_i2c_probe,
.probe_new = &bd957x_i2c_probe,
};
module_i2c_driver(bd957x_drv);

Some files were not shown because too many files have changed in this diff Show More