Files
kernel_xiaomi_raphael/include/soc/qcom/socinfo.h
UtsavBalar1231 66f533b6fa Merge remote-tracking branch 'origin/q' into auto-kernel
* origin/q:
  Revert "iommu: arm-smmu: Make restore of smmu-context runtime detectable"
  Revert "iommu: arm-smmu: Use same callback for thaw and restore"
  Revert "soc: qcom: Implement hibernation callbacks for jtag-etm"
  Revert "firmware: qcom: Register call back functions for hibernation"
  Revert "soc: qcom: smp2p: Implementing thaw callback"
  Revert "soc: qcom: smem: Implementing thaw callback"
  Revert "i2c: i2c-qcom-geni: Implementing thaw callback"
  Revert "iio: adc: Implementing thaw callback"
  Revert "input: qpnp-power-on:  Implementing thaw callback"
  Revert "thermal: qcom-spmi-temp-alarm: Add support for thaw callback"
  Revert "rtc: qpnp-rtc: Add support for thaw callback"
  Revert "mmc: sdhci-msm: Add hibernation callbacks"
  Revert "clk: qcom: Add support for enabling the critical clocks"
  Revert "serial: msm-geni-serial: Add support for thaw callback"
  ARM: dts: msm: Bring all board specific changes to common file for QCS610
  msm: camera: Allow applying request if congestion comes
  ARM: dts: msm: Add initial dts support for QCM6125
  soc: qcom: socinfo: Add support for QCM6125/QCS6125 soc-id
  ARM: dts: qcom: Add support for POMS on sim-video-panel
  arm64: dts: msm: Add dt entry for manual fw loading
  ARM: dts: msm: remove default SA6155 DP pinctrl
  ARM: dts: msm: Enable USB type-C analog audio on SDM660
  net-ipv6-ndisc: add support for 'PREF64' dns64 prefix identifier
  fbdev: msm: call pxl clk unprepare during suspend
  msm: vidc: Fix in deciding power mode
  ARM: dts: msm: Include camera sensor DTSi file for QCS410
  USB: gadget: Add a print for Boot marker KPI
  msm: camera: isp: Add trace event in case of irq delay detected
  msm: camera: csiphy: Clear secure phy flags on release
  msm: ais: fix csid fatal error issue
  ANDROID: net: bpf: permit redirect from ingress L3 to egress L2 devices at near max mtu
  ARM: dts: msm: Enable sdx_ext_ipc and set policy to NOP in sa515m
  drivers: soc: sdx_ext_ipc: Add option to change default policy
  msm: adsprpc: Fix array index underflow problem
  power: smb1398: Fix array index out of bounds error
  msm: ipa: update MHI event id logic
  usb: dwc3: gadget: Avoid spuriously printing NO_PULLUP in log
  Add S2R and S2D support in KMD
  drm/bridge: add anx7625 to drm device pm link
  ARM: dts: msm: add hgsl to sa8195 vm for GPU doorbell

Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
2020-06-23 13:03:31 +05:30

298 lines
10 KiB
C

/*
* Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _ARCH_ARM_MACH_MSM_SOCINFO_H_
#define _ARCH_ARM_MACH_MSM_SOCINFO_H_
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/of_fdt.h>
#include <linux/of.h>
#include <asm/cputype.h>
/*
* SOC version type with major number in the upper 16 bits and minor
* number in the lower 16 bits. For example:
* 1.0 -> 0x00010000
* 2.3 -> 0x00020003
*/
#define SOCINFO_VERSION_MAJOR(ver) (((ver) & 0xffff0000) >> 16)
#define SOCINFO_VERSION_MINOR(ver) ((ver) & 0x0000ffff)
#define SOCINFO_VERSION(maj, min) ((((maj) & 0xffff) << 16)|((min) & 0xffff))
#ifdef CONFIG_OF
#define of_board_is_cdp() of_machine_is_compatible("qcom,cdp")
#define of_board_is_sim() of_machine_is_compatible("qcom,sim")
#define of_board_is_rumi() of_machine_is_compatible("qcom,rumi")
#define of_board_is_fluid() of_machine_is_compatible("qcom,fluid")
#define of_board_is_liquid() of_machine_is_compatible("qcom,liquid")
#define of_board_is_dragonboard() \
of_machine_is_compatible("qcom,dragonboard")
#define of_board_is_cdp() of_machine_is_compatible("qcom,cdp")
#define of_board_is_mtp() of_machine_is_compatible("qcom,mtp")
#define of_board_is_qrd() of_machine_is_compatible("qcom,qrd")
#define of_board_is_xpm() of_machine_is_compatible("qcom,xpm")
#define of_board_is_skuf() of_machine_is_compatible("qcom,skuf")
#define of_board_is_sbc() of_machine_is_compatible("qcom,sbc")
#define machine_is_msm8974() of_machine_is_compatible("qcom,msm8974")
#define early_machine_is_msm8916() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8916")
#define early_machine_is_apq8084() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,apq8084")
#define early_machine_is_msm8996() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8996")
#define early_machine_is_msm8996_auto() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,msm8996-cdp")
#define early_machine_is_sm8150() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sm8150")
#define early_machine_is_sm8150p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sm8150p")
#define early_machine_is_sa8155() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa8155")
#define early_machine_is_sa8155p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa8155p")
#define early_machine_is_sdmshrike() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdmshrike")
#define early_machine_is_sm6150() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sm6150")
#define early_machine_is_sm6150p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sm6150p")
#define early_machine_is_sa8195p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa8195p")
#define early_machine_is_qcs405() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs405")
#define early_machine_is_qcs403() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs403")
#define early_machine_is_qcs401() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs401")
#define early_machine_is_qcs404() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs404")
#define early_machine_is_qcs407() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs407")
#define early_machine_is_sdxprairie() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdxprairie")
#define early_machine_is_mdm9607() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,mdm9607")
#define early_machine_is_sdmmagpie() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdmmagpie")
#define early_machine_is_sdmmagpiep() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdmmagpiep")
#define early_machine_is_sa6155p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa6155p")
#define early_machine_is_sa4155p() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa4155p")
#define early_machine_is_sa6155() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sa6155")
#define early_machine_is_trinket() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,trinket")
#define early_machine_is_qcs610() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs610")
#define early_machine_is_qcs410() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs410")
#define early_machine_is_atoll() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,atoll")
#define early_machine_is_atollp() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,atollp")
#define early_machine_is_sdm660() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm660")
#define early_machine_is_atoll_ab() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,atoll-ab")
#define early_machine_is_sda660() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda660")
#define early_machine_is_sdm660() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm660")
#define early_machine_is_sda660() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda660")
#define early_machine_is_sdm429w() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sdm429w")
#define early_machine_is_sda429w() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,sda429w")
#define early_machine_is_qcm6125() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcm6125")
#define early_machine_is_qcs6125() \
of_flat_dt_is_compatible(of_get_flat_dt_root(), "qcom,qcs6125")
#else
#define of_board_is_sim() 0
#define of_board_is_rumi() 0
#define of_board_is_fluid() 0
#define of_board_is_liquid() 0
#define of_board_is_dragonboard() 0
#define of_board_is_cdp() 0
#define of_board_is_mtp() 0
#define of_board_is_qrd() 0
#define of_board_is_xpm() 0
#define of_board_is_skuf() 0
#define of_board_is_sbc() 0
#define machine_is_msm8974() 0
#define early_machine_is_msm8916() 0
#define early_machine_is_apq8084() 0
#define early_machine_is_msm8996() 0
#define early_machine_is_sm8150() 0
#define early_machine_is_sm8150p() 0
#define early_machine_is_sa8155() 0
#define early_machine_is_sa8155p() 0
#define early_machine_is_sdmshrike() 0
#define early_machine_is_sm6150() 0
#define early_machine_is_sa8195p() 0
#define early_machine_is_sm6150p() 0
#define early_machine_is_qcs405() 0
#define early_machine_is_qcs403() 0
#define early_machine_is_qcs401() 0
#define early_machine_is_qcs404() 0
#define early_machine_is_qcs407() 0
#define early_machine_is_sdxprairie() 0
#define early_machine_is_mdm9607() 0
#define early_machine_is_sdmmagpie() 0
#define early_machine_is_sdmmagpiep() 0
#define early_machine_is_sa6155p() 0
#define early_machine_is_sa4155p() 0
#define early_machine_is_sa6155() 0
#define early_machine_is_trinket() 0
#define early_machine_is_qcs610() 0
#define early_machine_is_qcs410() 0
#define early_machine_is_atoll() 0
#define early_machine_is_atollp() 0
#define early_machine_is_sdm660() 0
#define early_machine_is_sda660() 0
#define early_machine_is_sdm429w() 0
#define early_machine_is_sda429w() 0
#define early_machine_is_qcm6125() 0
#define early_machine_is_qcs6125() 0
#endif
#define PLATFORM_SUBTYPE_MDM 1
#define PLATFORM_SUBTYPE_INTERPOSERV3 2
#define PLATFORM_SUBTYPE_SGLTE 6
#define SMEM_IMAGE_VERSION_TABLE 469
#define SMEM_HW_SW_BUILD_ID 137
#define SMEM_ID_VENDOR1 135
enum msm_cpu {
MSM_CPU_UNKNOWN = 0,
MSM_CPU_8960,
MSM_CPU_8960AB,
MSM_CPU_8064,
MSM_CPU_8974,
MSM_CPU_8974PRO_AA,
MSM_CPU_8974PRO_AB,
MSM_CPU_8974PRO_AC,
MSM_CPU_8916,
MSM_CPU_8084,
MSM_CPU_8996,
MSM_CPU_SM8150,
MSM_CPU_SM8150P,
MSM_CPU_SA8155,
MSM_CPU_SA8155P,
MSM_CPU_SA8195P,
MSM_CPU_SDMSHRIKE,
MSM_CPU_SM6150,
MSM_CPU_SM6150P,
MSM_CPU_QCS405,
MSM_CPU_QCS403,
MSM_CPU_QCS401,
MSM_CPU_QCS404,
MSM_CPU_QCS407,
SDX_CPU_SDXPRAIRIE,
MSM_CPU_9607,
MSM_CPU_SDMMAGPIE,
MSM_CPU_SDMMAGPIEP,
MSM_CPU_SA6155P,
MSM_CPU_SA4155P,
MSM_CPU_SA6155,
MSM_CPU_TRINKET,
MSM_CPU_QCS610,
MSM_CPU_QCS410,
MSM_CPU_ATOLL,
MSM_CPU_ATOLLP,
MSM_CPU_ATOLL_AB,
MSM_CPU_SDM660,
MSM_CPU_SDA660,
MSM_CPU_SDM429W,
MSM_CPU_SDA429W,
MSM_CPU_QCM6125,
MSM_CPU_QCS6125,
};
struct msm_soc_info {
enum msm_cpu generic_soc_type;
char *soc_id_string;
};
enum pmic_model {
PMIC_MODEL_PM8058 = 13,
PMIC_MODEL_PM8028 = 14,
PMIC_MODEL_PM8901 = 15,
PMIC_MODEL_PM8027 = 16,
PMIC_MODEL_ISL_9519 = 17,
PMIC_MODEL_PM8921 = 18,
PMIC_MODEL_PM8018 = 19,
PMIC_MODEL_PM8015 = 20,
PMIC_MODEL_PM8014 = 21,
PMIC_MODEL_PM8821 = 22,
PMIC_MODEL_PM8038 = 23,
PMIC_MODEL_PM8922 = 24,
PMIC_MODEL_PM8917 = 25,
PMIC_MODEL_UNKNOWN = 0xFFFFFFFF
};
#define HARDWARE_PLATFORM_UNKNOWN 0
#define HARDWARE_PLATFORM_CEPHEUS 1
#define HARDWARE_PLATFORM_DAVINCI 2
#define HARDWARE_PLATFORM_ANDROMEDA 3
#define HARDWARE_PLATFORM_RAPHAEL 4
#define HARDWARE_PLATFORM_HERCULES 5
#define HW_MAJOR_VERSION_SHIFT 16
#define HW_MAJOR_VERSION_MASK 0xFFFF0000
#define HW_MINOR_VERSION_SHIFT 0
#define HW_MINOR_VERSION_MASK 0x0000FFFF
#define HW_COUNTRY_VERSION_MASK 0xFFF00000
#define HW_COUNTRY_VERSION_SHIFT 20
#define HW_BUILD_VERSION_MASK 0x000F0000
#define HW_BUILD_VERSION_SHIFT 16
typedef enum {
CountryCN = 0,
CountryGlobal = 1,
CountryIndia = 2,
INVALID,
} CountryType;
uint32_t get_hw_version_platform(void);
uint32_t get_hw_country_version(void);
uint32_t get_hw_version_major(void);
uint32_t get_hw_version_minor(void);
uint32_t get_hw_version_build(void);
enum msm_cpu socinfo_get_msm_cpu(void);
uint32_t socinfo_get_id(void);
uint32_t socinfo_get_version(void);
uint32_t socinfo_get_raw_id(void);
char *socinfo_get_build_id(void);
char *socinfo_get_id_string(void);
uint32_t socinfo_get_platform_type(void);
uint32_t socinfo_get_platform_subtype(void);
uint32_t socinfo_get_platform_version(void);
uint32_t socinfo_get_serial_number(void);
enum pmic_model socinfo_get_pmic_model(void);
uint32_t socinfo_get_pmic_die_revision(void);
const char *product_name_get(void);
int __init socinfo_init(void) __must_check;
#endif