Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64: dts: qcom: msm8916-samsung-grandmax: Add initial device tree #240

Conversation

wonderfulShrineMaidenOfParadise
Copy link

@wonderfulShrineMaidenOfParadise wonderfulShrineMaidenOfParadise commented May 11, 2022

Samsung Galaxy Grand Max is a phone based on MSM8916. It is
similar to the other Samsung devices based on MSM8916 with only a few
minor differences.

The device tree contains initial support for the Core Prime with:

  • GPIO keys
  • SDHCI (internal and external storage)
  • USB Device Mode (on USB connector via the SM5504 MUIC)
  • UART
  • WCNSS (WiFi/BT)
  • Regulators
  • Vibrator
  • Fuelgauge (sec-fuelgaugecompatible with richtek,rt5033-battery)
  • Accelerometer LIS2HH
  • Sound and modem with amp nxp,tfa9895
  • Audio jack
  • Panel

TravMurav and others added 30 commits May 23, 2022 11:09
…service

Add DT bindings for memshare: QMI service that allocates
memory per remote processor request.

Signed-off-by: Nikita Travkin <nikitos.tr@gmail.com>
This QMI service provides memory region for remote processors (like
modem) on request. It is known to be used in GPS service in modem
firmware for some (most) of msm8916 devices.

This commit implements "guaranteed allocation" of memory using
reserved-memory regions because gps service crashes on some devices
unless specific address was provided.

Signed-off-by: Nikita Travkin <nikitos.tr@gmail.com>
The previous compile time fix was incomplete and still results in
warnings like:

WARNING: unmet direct dependencies detected for ARM_CPU_SUSPEND
  Depends on [n]: ARCH_SUSPEND_POSSIBLE [=n]
  Selected by [y]:
  - ARM_QCOM_SPM_CPUIDLE [=y] && CPU_IDLE [=y] && (ARM [=y] || ARM64) && (ARCH_QCOM [=n] || COMPILE_TEST [=y]) && !ARM64 && MMU [=y]

WARNING: unmet direct dependencies detected for QCOM_SCM
  Depends on [n]: (ARM [=y] || ARM64) && HAVE_ARM_SMCCC [=n]
  Selected by [y]:
  - ARM_QCOM_SPM_CPUIDLE [=y] && CPU_IDLE [=y] && (ARM [=y] || ARM64) && (ARCH_QCOM [=n] || COMPILE_TEST [=y]) && !ARM64 && MMU [=y]

Use a dependency on ARCH_SUSPEND_POSSIBLE as a prerequisite for
selecting ARM_CPU_SUSPEND, and a dependency on HAVE_ARM_SMCCC
for QCOM_SCM.

Fixes: 498ba2a ("cpuidle: Fix ARM_QCOM_SPM_CPUIDLE configuration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
…ivider is not enabled.

In cases when MND is not enabled (e.g. when only Half Integer Divider is
used), setting D registers makes no effect. Fail instead of making
ineffective write.

Fixes: 7f891fa ("clk: qcom: clk-rcg2: Add support for duty-cycle for RCG")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
…register

Sometimes calculation of d value may result in 0 because of the
rounding after integer division. This causes the following error:

[  113.969689] camss_gp1_clk_src: rcg didn't update its configuration.
[  113.969754] WARNING: CPU: 3 PID: 35 at drivers/clk/qcom/clk-rcg2.c:122 update_config+0xc8/0xdc

Make sure that D value is never zero.

Fixes: 7f891fa ("clk: qcom: clk-rcg2: Add support for duty-cycle for RCG")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
GPIO 31, 32 can be muxed to GCC_CAMSS_GP(1,2)_CLK respectively but the
function was never assigned to the pingroup (even though the function
exists already).

Add this mode to the related pins.

Fixes: 5373a2c ("pinctrl: qcom: Add msm8916 pinctrl driver")
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
msm8916 has (at least) 6 "General Purpose" clocks that can be muxed to
SoC pins. These clocks are:

GP_CLK{0, 1} : GPIO_{31, 32} (Belongs to CAMSS according to Linux)
GP_CLK_{1-3}{A, B} : GPIO_{49-51, 97, 12, 13} (Belongs to GCC itself)
GP_MN : GPIO_110 (Doesn't seem to be described in gcc,
    ignored in this patch)

Those clocks may be used as e.g. PWM sources for external peripherals.
Add more frequencies to the table for those clocks so it's possible
for arbitrary peripherals to make use of them.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
…driver data (v2)

This will allow us to add other MStar touchscreen variants' support.
No functional change.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
msg2138 only supports 2 fingers presses, and needs different processing
since second finger press is encoded as a delta position wrt. first one
and the packet/touch_event structs are not the same as msg2638.

Add support for it by implementing distinct structs and irq handler.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Some devices with msg2138 have back/menu/home keys.
Add support for them.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Add #define STMFTS_RETRY_COUNT 3 to retry stmfts_command() 3 times.
Without it, STMFTS_SYSTEM_RESET or STMFTS_SLEEP_OUT may return -110 to
failed attempt due to no event received for completion.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Some systems have clocks exposed to external devices. If the clock
controller supports duty-cycle configuration, such clocks can be used as
pwm outputs. In fact PWM and CLK subsystems are interfaced with in a
similar way and an "opposite" driver already exists (clk-pwm). Add a
driver that would enable pwm devices to be used via clk subsystem.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
The Light Pulse Generator (LPG) is a PWM-block found in a wide range of
PMICs from Qualcomm. These PMICs typically comes with 1-8 LPG instances,
with their output being routed to various other components, such as
current sinks or GPIOs.

Each LPG instance can operate on fixed parameters or based on a shared
lookup-table, altering the duty cycle over time. This provides the means
for hardware assisted transitions of LED brightness.

A typical use case for the fixed parameter mode is to drive a PWM
backlight control signal, the driver therefor allows each LPG instance
to be exposed to the kernel either through the LED framework or the PWM
framework.

A typical use case for the LED configuration is to drive RGB LEDs in
smartphones etc, for which the driver supports multiple channels to be
ganged up to a MULTICOLOR LED. In this configuration the pattern
generators will be synchronized, to allow for multi-color patterns.

The idea of modelling this as a LED driver ontop of a PWM driver was
considered, but setting the properties related to patterns does not fit
in the PWM API. Similarly the idea of just duplicating the lower bits in
a PWM and LED driver separately was considered, but this would not allow
the PWM channels and LEDs to be configured on a per-board basis. The
driver implements the more complex LED interface, and provides a PWM
interface on the side of that, in the same driver.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
SM5703 is another MFD from Silicon Mitus which has a very similar MUIC
unit to the one in SM5502. The only difference I've noticed is slightly different
configuration only enables the interrupts which are exactly the same as on SM5502.
If we make use of different interrupts in the future, this can be improved by having
a separate struct for SM5703, but the main functionality (detecting cable or OTG adapter)
is working properly.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
Zinitix touch controllers can use some of the sense lines for virtual
keys (like those found on many phones). Add support for those keys.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
It's not clear why it happens but some WCN3620 firmwares seem to
occasionally seems to send scan packets with rf_band = 0, which is
currently interpreted like 5 GHz band. This causes big WARNINGs later
because those bands are not initialized for WCN3620:

WARNING: CPU: 0 PID: 0 at net/mac80211/rx.c:4877 ieee80211_rx_list+0x488/0xa10 [mac80211]
Hardware name: Samsung Galaxy Grand Prime (SM-G530H) (DT)
pc : ieee80211_rx_list+0x488/0xa10 [mac80211]
lr : ieee80211_rx_napi+0x58/0xe0 [mac80211]
Call trace:
 ieee80211_rx_list+0x488/0xa10 [mac80211]
 ieee80211_rx_napi+0x58/0xe0 [mac80211]
 ieee80211_tasklet_handler+0xe4/0xf0 [mac80211]
 ...

Let's skip the check for WCN3620 for now and warn only once to avoid
spam in the kernel log.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
This dts adds support for wifi and lte variants of
Samsung Galaxy Tab A tablets released in 2015. (with both 8.0 and
9.7 inch displays)

Add a device tree for gt58 and gt510 with initial support for:

- SDHCI (internal and external storage)
- USB Device Mode
- UART
- Regulators
- WCNSS (WiFi/BT)
- GPIO keys

Most of the device tree is separated into
msm8916-samsung-gt5-common.dtsi as these devices share a lot of
hardware with each other.

v2: Add chassis-type

Signed-off-by: Jasper Korten <jja2000@gmail.com>
Co-developed-by: Siddharth Manthan <siddharth_manthan@outlook.com>
Signed-off-by: Siddharth Manthan <siddharth_manthan@outlook.com>
Co-developed-by: Nikita Travkin <nikita@trvn.ru>
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Motor is powered by VPH_PWR (aka Vbat) and controlled by GPIO.

Signed-off-by: Siddharth Manthan <siddharth.manthan@gmail.com>
gt510 uses maXTouch mXT1664T3 touch controller. Add it and regulators
that supply it.

Signed-off-by: Jasper Korten <jja2000@gmail.com>
Co-developed-by: Nikita Travkin <nikita@trvn.ru>
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
v2: Change interrupt to IRQ_TYPE_LEVEL_LOW to avoid "RETRIGEN workaround"
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
gt58 uses Zinitix bt532 touch controller.
Add it to device tree using Zinitix bt541 drivers.

Signed-off-by: Siddharth Manthan <siddharth.manthan@gmail.com>

v2: Add linux,keycodes
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
v3: Drop additional bt541 compatible, use new supply names
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
gt5 devices use additional MAX77849 MFD to handle battery, charging
and usb switching. Fuel-gauge from this MFD has a separate i2c line.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
This device has ST LIS2HH12 accelerometer and Capella CM3323 light sensor.
Add support for it.

Signed-off-by: Siddharth Manthan <siddharth.manthan@gmail.com>
v2: Make lis2hh12 interrupt IRQ_TYPE_LEVEL_HIGH
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
All other entries in reserved-memory list "reg"	before "no-map"
and prefix the 0 with "0x". Make this consistent to make the list
a bit easier to read.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
According to the ELF headers of the venus firmware binaries, only
~ 5 MiB (0x500000) of the venus memory region will actually end up
being used. Reduce the size of the reserved-memory region to make
slightly more RAM available for Linux.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
The modem (mpss) firmware size varies a lot from device to device.
It probably depends on the features that are enabled in the firmware,
so there are often differences of several megabytes. Unfortunately,
the current memory layout makes it really inconvenient to increase
the memory region for the modem.

mpss/wcnss/venus are placed contiguously in memory, which means that
changing the mpss size requires moving the wcnss/venus memory as well.
The size for wcnss/venus seems consistent on all devices though
so this is normally not necessary.

To avoid this, move wcnss/venus to the end of the space between
mpss and mba. The reserved-memory is still largely contiguous
but this allows growing mpss without moving wcnss/venus.

The only device where this does not help is longcheer-l8150 because
of its weird non-relocatable wcnss firmware. However, since it is
the only device with this problem it does not seem worth optimizing
for that case.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
The MUIC installed is a part of SM5703 MFD, and it seems to work
the same as the SM5502 MUIC unit.

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
v2: move around

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
@wonderfulShrineMaidenOfParadise wonderfulShrineMaidenOfParadise force-pushed the grandmax branch 2 times, most recently from cfc4f85 to 22ce6a4 Compare May 29, 2022 21:48
@wonderfulShrineMaidenOfParadise
Copy link
Author

  • Add msm8916-samsung-e2015-common.dtsi, with shared parts:
    • Reserved Memory
    • SM5504 MUIC
    • LIS2HH12 Accelerometer
  • Update E7 device tree

@wonderfulShrineMaidenOfParadise wonderfulShrineMaidenOfParadise force-pushed the grandmax branch 6 times, most recently from fefd68b to 58db968 Compare May 30, 2022 05:07
This reverts commit 9d3e41f.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
This reverts commit 8fdce0e.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
This reverts commit d985faf.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Samsung Galaxy E7 and Grand Max are smartphones using the MSM8916 SoC
released in 2015.

e2015 and a2015 are similar, with some differences in accelerometer,
MUIC and Vibrator. The common parts are shared in
msm8916-samsung-a2015-common.dtsi to reduce duplication.

Add a common device tree for with initial support for:

- GPIO keys
- Hall sensor for E7
- SDHCI (internal and external storage)
- USB Device Mode
- UART (on USB connector via the SM5504 MUIC)
- WCNSS (WiFi/BT)
- Regulators
- Sound and modem with amp nxp,tfa9895
- Audio jack

The two devices (and all other variants of E7/Grand Max released in 2015)
are very similar, with some differences in display, touchscreen and
sensors. The common parts are shared in
msm8916-samsung-e2015-common.dtsi to reduce duplication.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Samsung Galaxy E7 is a smartphone using the MSM8916 SoC released in 2015.

Motor is powered by VPH_PWR (aka Vbat) and controlled by GPIO.

The difference of accelerometer between E7/A3/A5 is the sensor chip.
ST LIS2HH12 is used instead.

On E7 the touch key is supplied by a single fixed regulator (enabled via
GPIO 97) that supplies both MCU and LED.

Unfortunately, some E7 were released with outdated 32-bit only firmware
and never received any update from Samsung. Since the 32-bit TrustZone
firmware is signed there seems to be no way currently to actually boot
this device tree on arm64 Linux on those variants at the moment. :(

However, it is possible to use this device tree by compiling an ARM32
kernel instead. The device tree can be easily built on ARM32 with
an #include and it works really well there. To avoid confusion for others
it is still better to add this device tree on arm64. Otherwise it's easy
to forget to update this one when making some changes that affect all
MSM8916 devices.

Maybe someone finds a way to boot ARM64 Linux on those device at some
point. In this case I expect that this device tree can be simply used
as-is.

v2: Make lis2hh12 interrupt IRQ_TYPE_LEVEL_HIGH
Co-developed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
v3: Use msm8916-samsung-e2015-common.dtsi and move accelerometer to it
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
bolilingmeng89006 and others added 8 commits May 31, 2022 20:56
Samsung Galaxy Grand Max is a smartphone using the MSM8916 SoC released in
2015.

Grand Max and E5/E7 are similar, with some differences in hall sensor,
panel, touchscreen and touchkey. The common parts are shared in
msm8916-samsung-e2015-common.dtsi to reduce duplication.

Unfortunately, some Grand Max were released with outdated 32-bit only firmware
and never received any update from Samsung. Since the 32-bit TrustZone
firmware is signed there seems to be no way currently to actually boot
this device tree on arm64 Linux on those variants at the moment. :(

However, it is possible to use this device tree by compiling an ARM32
kernel instead. The device tree can be easily built on ARM32 with
an #include and it works really well there. To avoid confusion for others
it is still better to add this device tree on arm64. Otherwise it's easy
to forget to update this one when making some changes that affect all
MSM8916 devices.

Maybe someone finds a way to boot ARM64 Linux on those device at some
point. In this case I expect that this device tree can be simply used
as-is.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
After adding all necessary support for MSM8916 SMP/cpuidle without PSCI
on ARM32, build the Samsung Galaxy Grand Max device tree from the arm64
tree together with the ARM32 include to allow booting this device on ARM32.

The approach to include device tree files from other architectures is
inspired from e.g. the Raspberry Pi (bcm2711-rpi-4-b.dts) where this is
used to build the device tree for both ARM32 and ARM64.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
E5, E7 and Grand Max have ST LIS2HH12 accelerometer.
Add support for it.

v2: Change interrupt to IRQ_TYPE_LEVEL_HIGH
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
v3: Move from msm8916-samsung-e7
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
E7 uses a ST-Microelectronics FingerTip touchscreen that is connected to
blsp_i2c5. Add it to the device tree.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
…r-generator

X-Code-Generator: msm8916-mainline/linux-panel-drivers@4fae332 (dirty)
Signed-off-by: lmdpdg <lmdpdg@localhost>
…UOUS

Without MIPI_DSI_CLOCK_NON_CONTINUOUS, s6d2aa0x62-lpm053a250a will not work.

Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com>
@wonderfulShrineMaidenOfParadise
Copy link
Author

/delete-node/ i2c-nfc; for msm8916-samsung-grandmax since it's unavailable on Grand Max series

@stephan-gh
Copy link
Member

Pushed to rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.