mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
8de262531f
- Set 'struct device' fwnode when registering a new device - New Drivers - Add support for ROHM BD70528 PMIC - New Device Support - Add support for LP87561 4-Phase Regulator to TI LP87565 PMIC - Add support for RK809 and RK817 to Rockchip RK808 - Add support for Lid Angle to ChromeOS core - Add support for CS47L15 CODEC to Madera core - Add support for CS47L92 CODEC to Madera core - Add support for ChromeOS (legacy) Accelerometers in ChromeOS core - Add support for Add Intel Elkhart Lake PCH to Intel LPSS - New Functionality - Provide regulator supply information when registering; madera-core - Additional Device Tree support; lp87565, madera, cros-ec, rohm,bd71837-pmic - Allow over-riding power button press via Device Tree; rohm-bd718x7 - Differentiate between running processors; cros_ec_dev - Fix-ups - Big header file update; cros_ec_commands.h - Split header per-subsystem; rohm-bd718x7 - Remove superfluous code; menelaus, cs5535-mfd, cs47lXX-tables - Trivial; sorting, coding style; intel-lpss-pci - Only remove Power Off functionality if set locally; rk808 - Make use for Power Off Prepare(); rk808 - Fix spelling mistake in header guards; stmfx - Properly free IDA resources - SPDX fixups; cs47lXX-tables, madera - Error path fixups; hi655x-pmic - Bug Fixes - Add missing break in case() statement - Repair undefined behaviour when not initialising variables; arizona-core, madera-core - Fix reference to Device Tree documentation; madera -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAl0sLxgACgkQUa+KL4f8 d2E25Q/9HmDJIdfyDQg0xv5IM5HS1WsP9BcJCEgoRIsad4mMDRYt+ZeLbslwMhue E9tsFH359gGvyqR+7d6hPpEUET1UEcJy4eRD1zAc0+epllQTDHSy8oHt1dtH+8xB 2AU5rvAKOqBk83D+V2Hkx2KcroWEQQNYIoR9/12Pi3xmEB1uaCO0/Ajd3B28bIBM Tzi3cVQ3U7jY9EIM44GVTsjDAbMSkQR0iab6cQF0vJAWaUmGKlsO7iRrU1XkN69V qXyBauI8WGiGssihrE8r+jYvHvmg7hA9OKZIckUaMXD/k7kpHbwIaFRh7gukq4Re Q6Cy30NfVJ1tY66/5oqN6gj5znfeuEudMCCzYAkzlROSp5eApe2Ke5ajYn3kOCZd ZKcsrw9Fiox1lKmuWXDbyf0nqf4zwdDPAnShRWaaF5aipwgywyGcwSigVtK4F0P5 Hjc5RLv7GjTAJq+ZzwgKyAdtx8L0mhdLd1ZTQpEXk/g/E9dW4GF72hWj9TQ/9BnA ZflKv8aP3lDGRHgO3Huwi4lMzskB8BVCQMCFwLwGs5cY1oZQhAjTdJzBZjTGexhC evuuA8OUsCrOWMvnZf3saSdHJ1iMHtfPnqEGHRJQtNj4fFaXv80LasIomvvfJc1/ 9JlRyAgm2pF7YDrgTh65ZzBb324eKSZZoAj9XZbnTyzxUAcF69A= =A3jw -----END PGP SIGNATURE----- Merge tag 'mfd-next-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "Core Frameworks: - Set 'struct device' fwnode when registering a new device New Drivers: - Add support for ROHM BD70528 PMIC New Device Support: - Add support for LP87561 4-Phase Regulator to TI LP87565 PMIC - Add support for RK809 and RK817 to Rockchip RK808 - Add support for Lid Angle to ChromeOS core - Add support for CS47L15 CODEC to Madera core - Add support for CS47L92 CODEC to Madera core - Add support for ChromeOS (legacy) Accelerometers in ChromeOS core - Add support for Add Intel Elkhart Lake PCH to Intel LPSS New Functionality: - Provide regulator supply information when registering; madera-core - Additional Device Tree support; lp87565, madera, cros-ec, rohm,bd71837-pmic - Allow over-riding power button press via Device Tree; rohm-bd718x7 - Differentiate between running processors; cros_ec_dev Fix-ups: - Big header file update; cros_ec_commands.h - Split header per-subsystem; rohm-bd718x7 - Remove superfluous code; menelaus, cs5535-mfd, cs47lXX-tables - Trivial; sorting, coding style; intel-lpss-pci - Only remove Power Off functionality if set locally; rk808 - Make use for Power Off Prepare(); rk808 - Fix spelling mistake in header guards; stmfx - Properly free IDA resources - SPDX fixups; cs47lXX-tables, madera - Error path fixups; hi655x-pmic Bug Fixes: - Add missing break in case() statement - Repair undefined behaviour when not initialising variables; arizona-core, madera-core - Fix reference to Device Tree documentation; madera" * tag 'mfd-next-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (45 commits) mfd: hi655x-pmic: Fix missing return value check for devm_regmap_init_mmio_clk mfd: madera: Fixup SPDX headers mfd: madera: Remove some unused registers and fix some defaults mfd: intel-lpss: Release IDA resources mfd: intel-lpss: Add Intel Elkhart Lake PCH PCI IDs mfd: cs5535-mfd: Remove ifdef OLPC noise mfd: stmfx: Fix macro definition spelling dt-bindings: mfd: Add link to ROHM BD71847 Datasheet MAINAINERS: Swap words in INTEL PMIC MULTIFUNCTION DEVICE DRIVERS mfd: cros_ec_dev: Register cros_ec_accel_legacy driver as a subdevice mfd: rk808: Prepare rk805 for poweroff mfd: rk808: Check pm_power_off pointer mfd: cros_ec: differentiate SCP from EC by feature bit dt-bindings: Add binding for cros-ec-rpmsg mfd: madera: Add Madera core support for CS47L92 mfd: madera: Add Madera core support for CS47L15 mfd: madera: Update DT bindings to add additional CODECs mfd: madera: Add supply mapping for MICVDD mfd: madera: Fix potential uninitialised use of variable mfd: madera: Fix bad reference to pinctrl.txt file ...
175 lines
4.0 KiB
C
175 lines
4.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* cs5535-mfd.c - core MFD driver for CS5535/CS5536 southbridges
|
|
*
|
|
* The CS5535 and CS5536 has an ISA bridge on the PCI bus that is
|
|
* used for accessing GPIOs, MFGPTs, ACPI, etc. Each subdevice has
|
|
* an IO range that's specified in a single BAR. The BAR order is
|
|
* hardcoded in the CS553x specifications.
|
|
*
|
|
* Copyright (c) 2010 Andres Salomon <dilinger@queued.net>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/mfd/core.h>
|
|
#include <linux/module.h>
|
|
#include <linux/pci.h>
|
|
#include <asm/olpc.h>
|
|
|
|
#define DRV_NAME "cs5535-mfd"
|
|
|
|
enum cs5535_mfd_bars {
|
|
SMB_BAR = 0,
|
|
GPIO_BAR = 1,
|
|
MFGPT_BAR = 2,
|
|
PMS_BAR = 4,
|
|
ACPI_BAR = 5,
|
|
NR_BARS,
|
|
};
|
|
|
|
static int cs5535_mfd_res_enable(struct platform_device *pdev)
|
|
{
|
|
struct resource *res;
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
|
if (!res) {
|
|
dev_err(&pdev->dev, "can't fetch device resource info\n");
|
|
return -EIO;
|
|
}
|
|
|
|
if (!request_region(res->start, resource_size(res), DRV_NAME)) {
|
|
dev_err(&pdev->dev, "can't request region\n");
|
|
return -EIO;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int cs5535_mfd_res_disable(struct platform_device *pdev)
|
|
{
|
|
struct resource *res;
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
|
|
if (!res) {
|
|
dev_err(&pdev->dev, "can't fetch device resource info\n");
|
|
return -EIO;
|
|
}
|
|
|
|
release_region(res->start, resource_size(res));
|
|
return 0;
|
|
}
|
|
|
|
static struct resource cs5535_mfd_resources[NR_BARS];
|
|
|
|
static struct mfd_cell cs5535_mfd_cells[] = {
|
|
{
|
|
.id = SMB_BAR,
|
|
.name = "cs5535-smb",
|
|
.num_resources = 1,
|
|
.resources = &cs5535_mfd_resources[SMB_BAR],
|
|
},
|
|
{
|
|
.id = GPIO_BAR,
|
|
.name = "cs5535-gpio",
|
|
.num_resources = 1,
|
|
.resources = &cs5535_mfd_resources[GPIO_BAR],
|
|
},
|
|
{
|
|
.id = MFGPT_BAR,
|
|
.name = "cs5535-mfgpt",
|
|
.num_resources = 1,
|
|
.resources = &cs5535_mfd_resources[MFGPT_BAR],
|
|
},
|
|
{
|
|
.id = PMS_BAR,
|
|
.name = "cs5535-pms",
|
|
.num_resources = 1,
|
|
.resources = &cs5535_mfd_resources[PMS_BAR],
|
|
|
|
.enable = cs5535_mfd_res_enable,
|
|
.disable = cs5535_mfd_res_disable,
|
|
},
|
|
{
|
|
.id = ACPI_BAR,
|
|
.name = "cs5535-acpi",
|
|
.num_resources = 1,
|
|
.resources = &cs5535_mfd_resources[ACPI_BAR],
|
|
|
|
.enable = cs5535_mfd_res_enable,
|
|
.disable = cs5535_mfd_res_disable,
|
|
},
|
|
};
|
|
|
|
static const char *olpc_acpi_clones[] = {
|
|
"olpc-xo1-pm-acpi",
|
|
"olpc-xo1-sci-acpi"
|
|
};
|
|
|
|
static int cs5535_mfd_probe(struct pci_dev *pdev,
|
|
const struct pci_device_id *id)
|
|
{
|
|
int err, i;
|
|
|
|
err = pci_enable_device(pdev);
|
|
if (err)
|
|
return err;
|
|
|
|
/* fill in IO range for each cell; subdrivers handle the region */
|
|
for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) {
|
|
int bar = cs5535_mfd_cells[i].id;
|
|
struct resource *r = &cs5535_mfd_resources[bar];
|
|
|
|
r->flags = IORESOURCE_IO;
|
|
r->start = pci_resource_start(pdev, bar);
|
|
r->end = pci_resource_end(pdev, bar);
|
|
|
|
/* id is used for temporarily storing BAR; unset it now */
|
|
cs5535_mfd_cells[i].id = 0;
|
|
}
|
|
|
|
err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells,
|
|
ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL);
|
|
if (err) {
|
|
dev_err(&pdev->dev, "MFD add devices failed: %d\n", err);
|
|
goto err_disable;
|
|
}
|
|
|
|
if (machine_is_olpc())
|
|
mfd_clone_cell("cs5535-acpi", olpc_acpi_clones, ARRAY_SIZE(olpc_acpi_clones));
|
|
|
|
dev_info(&pdev->dev, "%zu devices registered.\n",
|
|
ARRAY_SIZE(cs5535_mfd_cells));
|
|
|
|
return 0;
|
|
|
|
err_disable:
|
|
pci_disable_device(pdev);
|
|
return err;
|
|
}
|
|
|
|
static void cs5535_mfd_remove(struct pci_dev *pdev)
|
|
{
|
|
mfd_remove_devices(&pdev->dev);
|
|
pci_disable_device(pdev);
|
|
}
|
|
|
|
static const struct pci_device_id cs5535_mfd_pci_tbl[] = {
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) },
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) },
|
|
{ 0, }
|
|
};
|
|
MODULE_DEVICE_TABLE(pci, cs5535_mfd_pci_tbl);
|
|
|
|
static struct pci_driver cs5535_mfd_driver = {
|
|
.name = DRV_NAME,
|
|
.id_table = cs5535_mfd_pci_tbl,
|
|
.probe = cs5535_mfd_probe,
|
|
.remove = cs5535_mfd_remove,
|
|
};
|
|
|
|
module_pci_driver(cs5535_mfd_driver);
|
|
|
|
MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
|
|
MODULE_DESCRIPTION("MFD driver for CS5535/CS5536 southbridge's ISA PCI device");
|
|
MODULE_LICENSE("GPL");
|