Commit 0691cd47 authored by Jonathan Cameron's avatar Jonathan Cameron

Merge branch 'immutable-qcom-spmi-rradc' into togreg

Immutable branch used to allow changes to SPMI and MFD subsystems
needed by this driver to be pulled into those trees as well if
relevant.
parents 9cf0b618 72c7df85
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/qcom,spmi-rradc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm's SPMI PMIC Round Robin ADC
maintainers:
- Caleb Connolly <caleb.connolly@linaro.org>
description: |
The Qualcomm SPMI Round Robin ADC (RRADC) provides interface to clients to
read the voltage, current and temperature for supported peripherals such as
the battery thermistor die temperature, charger temperature, USB and DC input
voltage / current and battery ID resistor.
properties:
compatible:
enum:
- qcom,pmi8998-rradc
- qcom,pm660-rradc
reg:
maxItems: 1
qcom,batt-id-delay-ms:
description: Sets the hardware settling time for the battery ID resistor.
enum: [0, 1, 4, 12, 20, 40, 60, 80]
"#io-channel-cells":
const: 1
required:
- compatible
- reg
additionalProperties: false
examples:
- |
pmic {
#address-cells = <1>;
#size-cells = <0>;
pmic_rradc: adc@4500 {
compatible = "qcom,pmi8998-rradc";
reg = <0x4500>;
#io-channel-cells = <1>;
};
};
......@@ -822,6 +822,18 @@ config QCOM_PM8XXX_XOADC
To compile this driver as a module, choose M here: the module
will be called qcom-pm8xxx-xoadc.
config QCOM_SPMI_RRADC
tristate "Qualcomm SPMI RRADC"
depends on MFD_SPMI_PMIC
help
This is for the PMIC Round Robin ADC driver.
This driver exposes the battery ID resistor, battery thermal, PMIC die
temperature, charger USB in and DC in voltage and current.
To compile this driver as a module, choose M here: the module will
be called qcom-qpmi-rradc.
config QCOM_SPMI_IADC
tristate "Qualcomm SPMI PMIC current ADC"
depends on SPMI
......
......@@ -78,6 +78,7 @@ obj-$(CONFIG_NPCM_ADC) += npcm_adc.o
obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o
obj-$(CONFIG_QCOM_SPMI_ADC5) += qcom-spmi-adc5.o
obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o
obj-$(CONFIG_QCOM_SPMI_RRADC) += qcom-spmi-rradc.o
obj-$(CONFIG_QCOM_VADC_COMMON) += qcom-vadc-common.o
obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
obj-$(CONFIG_QCOM_PM8XXX_XOADC) += qcom-pm8xxx-xoadc.o
......
This diff is collapsed.
This diff is collapsed.
......@@ -386,6 +386,23 @@ static struct bus_type spmi_bus_type = {
.uevent = spmi_drv_uevent,
};
/**
* spmi_device_from_of() - get the associated SPMI device from a device node
*
* @np: device node
*
* Returns the struct spmi_device associated with a device node or NULL.
*/
struct spmi_device *spmi_device_from_of(struct device_node *np)
{
struct device *dev = bus_find_device_by_of_node(&spmi_bus_type, np);
if (dev)
return to_spmi_device(dev);
return NULL;
}
EXPORT_SYMBOL_GPL(spmi_device_from_of);
/**
* spmi_controller_alloc() - Allocate a new SPMI device
* @ctrl: associated controller
......
......@@ -164,6 +164,9 @@ static inline void spmi_driver_unregister(struct spmi_driver *sdrv)
module_driver(__spmi_driver, spmi_driver_register, \
spmi_driver_unregister)
struct device_node;
struct spmi_device *spmi_device_from_of(struct device_node *np);
int spmi_register_read(struct spmi_device *sdev, u8 addr, u8 *buf);
int spmi_ext_register_read(struct spmi_device *sdev, u8 addr, u8 *buf,
size_t len);
......
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2022 Linaro. All rights reserved.
* Author: Caleb Connolly <caleb.connolly@linaro.org>
*/
#ifndef __QCOM_SPMI_PMIC_H__
#define __QCOM_SPMI_PMIC_H__
#include <linux/device.h>
#define COMMON_SUBTYPE 0x00
#define PM8941_SUBTYPE 0x01
#define PM8841_SUBTYPE 0x02
#define PM8019_SUBTYPE 0x03
#define PM8226_SUBTYPE 0x04
#define PM8110_SUBTYPE 0x05
#define PMA8084_SUBTYPE 0x06
#define PMI8962_SUBTYPE 0x07
#define PMD9635_SUBTYPE 0x08
#define PM8994_SUBTYPE 0x09
#define PMI8994_SUBTYPE 0x0a
#define PM8916_SUBTYPE 0x0b
#define PM8004_SUBTYPE 0x0c
#define PM8909_SUBTYPE 0x0d
#define PM8028_SUBTYPE 0x0e
#define PM8901_SUBTYPE 0x0f
#define PM8950_SUBTYPE 0x10
#define PMI8950_SUBTYPE 0x11
#define PM8998_SUBTYPE 0x14
#define PMI8998_SUBTYPE 0x15
#define PM8005_SUBTYPE 0x18
#define PM660L_SUBTYPE 0x1A
#define PM660_SUBTYPE 0x1B
#define PM8150_SUBTYPE 0x1E
#define PM8150L_SUBTYPE 0x1f
#define PM8150B_SUBTYPE 0x20
#define PMK8002_SUBTYPE 0x21
#define PM8009_SUBTYPE 0x24
#define PM8150C_SUBTYPE 0x26
#define SMB2351_SUBTYPE 0x29
#define PMI8998_FAB_ID_SMIC 0x11
#define PMI8998_FAB_ID_GF 0x30
#define PM660_FAB_ID_GF 0x0
#define PM660_FAB_ID_TSMC 0x2
#define PM660_FAB_ID_MX 0x3
struct qcom_spmi_pmic {
unsigned int type;
unsigned int subtype;
unsigned int major;
unsigned int minor;
unsigned int rev2;
unsigned int fab_id;
const char *name;
};
const struct qcom_spmi_pmic *qcom_pmic_get(struct device *dev);
#endif /* __QCOM_SPMI_PMIC_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment