From 1fac34ad32a73997c1b6dab204ec633dbaf06da7 Mon Sep 17 00:00:00 2001 From: Jasper Korten Date: Thu, 10 Mar 2022 14:35:22 +0100 Subject: [PATCH 1/5] arm64: dts: qcom: msm8916-samsung-on7: Add backlight --- .../boot/dts/qcom/msm8916-samsung-on7.dts | 53 +++++++++++++++++++ arch/arm64/configs/msm8916_defconfig | 1 + 2 files changed, 54 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts index 6d5e48336b02c9..0ff5778a5b373b 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts @@ -50,6 +50,51 @@ }; }; + i2c-bl { + compatible = "i2c-gpio"; + sda-gpios = <&tlmm 101 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + scl-gpios = <&tlmm 102 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + + pinctrl-names = "default"; + pinctrl-0 = <&bl_i2c_default>; + + #address-cells = <1>; + #size-cells = <0>; + + lm3632@11 { + compatible = "ti,lm3632"; + reg = <0x11>; + + enable-gpios = <&tlmm 98 GPIO_ACTIVE_HIGH>; + + regulators { + compatible = "ti,lm363x-regulator"; + + enable-gpios = <&tlmm 97 GPIO_ACTIVE_HIGH>, + <&tlmm 120 GPIO_ACTIVE_HIGH>; + + reg_lcd_vboost: vboost { + regulator-name = "lcd_boost"; + regulator-min-microvolt = <6000000>; + regulator-max-microvolt = <6000000>; + regulator-always-on; + }; + + reg_lcd_vpos: vpos { + regulator-name = "lcd_vpos"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + }; + + reg_lcd_vneg: vneg { + regulator-name = "lcd_vneg"; + regulator-min-microvolt = <5500000>; + regulator-max-microvolt = <5500000>; + }; + }; + }; + }; + i2c-muic { compatible = "i2c-gpio"; sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; @@ -134,6 +179,14 @@ bias-pull-up; }; + bl_i2c_default: bl-i2c-default { + pins = "gpio101", "gpio102"; + function = "gpio"; + + drive-strength = <2>; + bias-disable; + }; + muic_i2c_default: muic-i2c-default-state { pins = "gpio105", "gpio106"; function = "gpio"; diff --git a/arch/arm64/configs/msm8916_defconfig b/arch/arm64/configs/msm8916_defconfig index b7399cf2f59356..bea30b49e95018 100644 --- a/arch/arm64/configs/msm8916_defconfig +++ b/arch/arm64/configs/msm8916_defconfig @@ -254,6 +254,7 @@ CONFIG_QCOM_WDT=y CONFIG_PM8916_WATCHDOG=y CONFIG_MFD_SPMI_PMIC=y CONFIG_MFD_RT5033=m +CONFIG_MFD_TI_LMU=m CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_QCOM_SMD_RPM=y CONFIG_REGULATOR_QCOM_SPMI=y From df988c4c33b596076b5fb0beea3db02e28cbd87a Mon Sep 17 00:00:00 2001 From: Jasper Korten Date: Thu, 10 Mar 2022 19:29:53 +0100 Subject: [PATCH 2/5] drm/panel: Add driver for Samsung S6D7AA0X62 BV050HDM DSI video mode panel --- drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile | 1 + .../panel/panel-samsung-s6d7aa0x62-bv050hdm.c | 356 ++++++++++++++++++ 3 files changed, 364 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6d7aa0x62-bv050hdm.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index fe86ad6580ed0b..ee5a0f14aa6aab 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -611,6 +611,13 @@ config DRM_PANEL_SAMSUNG_LD9040 depends on BACKLIGHT_CLASS_DEVICE select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6D7AA0X62_BV050HDM + tristate "Samsung S6D7AA0X62 BV050HDM DSI video mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + config DRM_PANEL_SAMSUNG_S6E3FA7 tristate "Samsung S6E3FA7 panel driver" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 320e2c7be668a3..f344871c2b6d63 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20) += panel-samsung-atna33xc20.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_DB7430) += panel-samsung-db7430.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0X62_BV050HDM) += panel-samsung-s6d7aa0x62-bv050hdm.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D27A1) += panel-samsung-s6d27a1.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0) += panel-samsung-s6d7aa0.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6d7aa0x62-bv050hdm.c b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0x62-bv050hdm.c new file mode 100644 index 00000000000000..a99b4cd9412be9 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6d7aa0x62-bv050hdm.c @@ -0,0 +1,356 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2024 Jasper Korten (jja2000@gmail.com) +// Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: +// Copyright (c) 2018, The Linux Foundation. All rights reserved. + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +struct s6d7aa0x62_bv050hdm { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct regulator_bulk_data supplies[3]; + struct gpio_desc *reset_gpio; +}; + +static inline +struct s6d7aa0x62_bv050hdm *to_s6d7aa0x62_bv050hdm(struct drm_panel *panel) +{ + return container_of(panel, struct s6d7aa0x62_bv050hdm, panel); +} + +static void s6d7aa0x62_bv050hdm_reset(struct s6d7aa0x62_bv050hdm *ctx) +{ + gpiod_set_value_cansleep(ctx->reset_gpio, 0); + msleep(20); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + usleep_range(1000, 2000); + gpiod_set_value_cansleep(ctx->reset_gpio, 0); + msleep(20); +} + +static int s6d7aa0x62_bv050hdm_on(struct s6d7aa0x62_bv050hdm *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + int ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); + mipi_dsi_dcs_write_seq(dsi, 0xf1, 0x5a, 0x5a); + mipi_dsi_dcs_write_seq(dsi, 0xfc, 0xa5, 0xa5); + mipi_dsi_dcs_write_seq(dsi, 0xd0, 0x00, 0x10); + mipi_dsi_dcs_write_seq(dsi, 0xb1, 0x12); + mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x14, 0x22, 0x2f, 0x18); + mipi_dsi_dcs_write_seq(dsi, 0xb3, 0x11); + mipi_dsi_dcs_write_seq(dsi, 0xba, + 0x03, 0x19, 0x19, 0x11, 0x03, 0x05, 0x18, 0x18, + 0x77); + mipi_dsi_dcs_write_seq(dsi, 0xbc, 0x00, 0x4e, 0x0b); + mipi_dsi_dcs_write_seq(dsi, 0xc0, 0x80, 0x80, 0x30); + mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x03); + usleep_range(1000, 2000); + mipi_dsi_dcs_write_seq(dsi, 0xc2, 0x00); + usleep_range(10000, 11000); + mipi_dsi_dcs_write_seq(dsi, 0xc3, 0x40, 0x00, 0x28); + mipi_dsi_dcs_write_seq(dsi, 0xee, + 0xa8, 0x00, 0x95, 0x00, 0xa8, 0x00, 0x95, 0x00); + mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x02, 0x10, 0x10, 0xc4, 0x80); + mipi_dsi_dcs_write_seq(dsi, 0xf3, + 0x01, 0x93, 0x20, 0x22, 0x80, 0x05, 0x25, 0x3c, + 0x26, 0x00); + mipi_dsi_dcs_write_seq(dsi, 0xf7, + 0x01, 0x1b, 0x08, 0x0c, 0x09, 0x0d, 0x01, 0x01, + 0x01, 0x04, 0x06, 0x01, 0x01, 0x00, 0x00, 0x1a, + 0x01, 0x1b, 0x0a, 0x0e, 0x0b, 0x0f, 0x01, 0x01, + 0x01, 0x05, 0x07, 0x01, 0x01, 0x00, 0x00, 0x1a); + mipi_dsi_dcs_write_seq(dsi, 0xef, + 0x34, 0x12, 0x98, 0xba, 0x10, 0x80, 0x24, 0x80, + 0x80, 0x80, 0x00, 0x00, 0x00, 0x44, 0xa0, 0x82, + 0x00); + mipi_dsi_dcs_write_seq(dsi, 0xf6, 0x60, 0x25, 0x05, 0x00, 0x00, 0x03); + mipi_dsi_dcs_write_seq(dsi, 0xcd, + 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, + 0x2e, 0x2e, 0x2e, 0x2e, 0x2e); + mipi_dsi_dcs_write_seq(dsi, 0xce, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00); + mipi_dsi_dcs_write_seq(dsi, 0x53, 0x2c); + mipi_dsi_dcs_write_seq(dsi, 0x55, 0x01); + mipi_dsi_dcs_write_seq(dsi, 0xfa, + 0x01, 0x3f, 0x09, 0x0c, 0x00, 0x01, 0x06, 0x04, + 0x04, 0x0c, 0x10, 0x15, 0x16, 0x18, 0x1c, 0x20, + 0x2a); + mipi_dsi_dcs_write_seq(dsi, 0xfb, + 0x01, 0x3f, 0x09, 0x0c, 0x00, 0x01, 0x06, 0x04, + 0x04, 0x0c, 0x10, 0x15, 0x16, 0x18, 0x1c, 0x20, + 0x2a); + mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); + mipi_dsi_dcs_write_seq(dsi, 0xf1, 0xa5, 0xa5); + mipi_dsi_dcs_write_seq(dsi, 0xfc, 0x5a, 0x5a); + + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); + if (ret < 0) { + dev_err(dev, "Failed to exit sleep mode: %d\n", ret); + return ret; + } + msleep(120); + + ret = mipi_dsi_dcs_set_display_on(dsi); + if (ret < 0) { + dev_err(dev, "Failed to set display on: %d\n", ret); + return ret; + } + msleep(20); + + return 0; +} + +static int s6d7aa0x62_bv050hdm_off(struct s6d7aa0x62_bv050hdm *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_set_display_off(dsi); + if (ret < 0) { + dev_err(dev, "Failed to set display off: %d\n", ret); + return ret; + } + usleep_range(10000, 11000); + + ret = mipi_dsi_dcs_enter_sleep_mode(dsi); + if (ret < 0) { + dev_err(dev, "Failed to enter sleep mode: %d\n", ret); + return ret; + } + msleep(120); + + return 0; +} + +static int s6d7aa0x62_bv050hdm_prepare(struct drm_panel *panel) +{ + struct s6d7aa0x62_bv050hdm *ctx = to_s6d7aa0x62_bv050hdm(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + if (ret < 0) { + dev_err(dev, "Failed to enable regulators: %d\n", ret); + return ret; + } + + s6d7aa0x62_bv050hdm_reset(ctx); + + ret = s6d7aa0x62_bv050hdm_on(ctx); + if (ret < 0) { + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + return ret; + } + + return 0; +} + +static int s6d7aa0x62_bv050hdm_unprepare(struct drm_panel *panel) +{ + struct s6d7aa0x62_bv050hdm *ctx = to_s6d7aa0x62_bv050hdm(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + ret = s6d7aa0x62_bv050hdm_off(ctx); + if (ret < 0) + dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + + return 0; +} + +static const struct drm_display_mode s6d7aa0x62_bv050hdm_mode = { + .clock = (720 + 104 + 42 + 154) * (1280 + 16 + 4 + 12) * 60 / 1000, + .hdisplay = 720, + .hsync_start = 720 + 104, + .hsync_end = 720 + 104 + 42, + .htotal = 720 + 104 + 42 + 154, + .vdisplay = 1280, + .vsync_start = 1280 + 16, + .vsync_end = 1280 + 16 + 4, + .vtotal = 1280 + 16 + 4 + 12, + .width_mm = 62, + .height_mm = 106, + .type = DRM_MODE_TYPE_DRIVER, +}; + +static int s6d7aa0x62_bv050hdm_get_modes(struct drm_panel *panel, + struct drm_connector *connector) +{ + return drm_connector_helper_get_modes_fixed(connector, &s6d7aa0x62_bv050hdm_mode); +} + +static const struct drm_panel_funcs s6d7aa0x62_bv050hdm_panel_funcs = { + .prepare = s6d7aa0x62_bv050hdm_prepare, + .unprepare = s6d7aa0x62_bv050hdm_unprepare, + .get_modes = s6d7aa0x62_bv050hdm_get_modes, +}; + +static int s6d7aa0x62_bv050hdm_bl_update_status(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness = backlight_get_brightness(bl); + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return 0; +} + +// TODO: Check if /sys/class/backlight/.../actual_brightness actually returns +// correct values. If not, remove this function. +static int s6d7aa0x62_bv050hdm_bl_get_brightness(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness; + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return brightness & 0xff; +} + +static const struct backlight_ops s6d7aa0x62_bv050hdm_bl_ops = { + .update_status = s6d7aa0x62_bv050hdm_bl_update_status, + .get_brightness = s6d7aa0x62_bv050hdm_bl_get_brightness, +}; + +static struct backlight_device * +s6d7aa0x62_bv050hdm_create_backlight(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + const struct backlight_properties props = { + .type = BACKLIGHT_RAW, + .brightness = 255, + .max_brightness = 255, + }; + + return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, + &s6d7aa0x62_bv050hdm_bl_ops, &props); +} + +static int s6d7aa0x62_bv050hdm_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct s6d7aa0x62_bv050hdm *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->supplies[0].supply = "lcd"; + ctx->supplies[1].supply = "vpos"; + ctx->supplies[2].supply = "vneg"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), + ctx->supplies); + if (ret < 0) + return dev_err_probe(dev, ret, "Failed to get regulators\n"); + + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(ctx->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), + "Failed to get reset-gpios\n"); + + ctx->dsi = dsi; + mipi_dsi_set_drvdata(dsi, ctx); + + dsi->lanes = 4; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_NO_EOT_PACKET | + MIPI_DSI_MODE_VIDEO_NO_HBP; + + drm_panel_init(&ctx->panel, dev, &s6d7aa0x62_bv050hdm_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; + + ret = drm_panel_of_backlight(&ctx->panel); + if (ret) + return dev_err_probe(dev, ret, "Failed to get backlight\n"); + + /* Fallback to DCS backlight if no backlight is defined in DT */ + if (!ctx->panel.backlight) { + ctx->panel.backlight = s6d7aa0x62_bv050hdm_create_backlight(dsi); + if (IS_ERR(ctx->panel.backlight)) + return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), + "Failed to create backlight\n"); + } + + drm_panel_add(&ctx->panel); + + ret = mipi_dsi_attach(dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); + } + + return 0; +} + +static void s6d7aa0x62_bv050hdm_remove(struct mipi_dsi_device *dsi) +{ + struct s6d7aa0x62_bv050hdm *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + + ret = mipi_dsi_detach(dsi); + if (ret < 0) + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); + + drm_panel_remove(&ctx->panel); +} + +static const struct of_device_id s6d7aa0x62_bv050hdm_of_match[] = { + { .compatible = "samsung,s6d7aa0x62-bv050hdm" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, s6d7aa0x62_bv050hdm_of_match); + +static struct mipi_dsi_driver s6d7aa0x62_bv050hdm_driver = { + .probe = s6d7aa0x62_bv050hdm_probe, + .remove = s6d7aa0x62_bv050hdm_remove, + .driver = { + .name = "panel-s6d7aa0x62-bv050hdm", + .of_match_table = s6d7aa0x62_bv050hdm_of_match, + }, +}; +module_mipi_dsi_driver(s6d7aa0x62_bv050hdm_driver); + +MODULE_AUTHOR("Jasper Korten "); +MODULE_DESCRIPTION("DRM driver for Samsung S6D7AA0X62 BV050HDM HD"); +MODULE_LICENSE("GPL v2"); From a6dc89261e92f790637d6677b06a0e3895664312 Mon Sep 17 00:00:00 2001 From: Jasper Korten Date: Thu, 10 Mar 2022 19:31:26 +0100 Subject: [PATCH 3/5] arm64: dts: qcom: msm8916-samsung-on7: Add panel to dts --- .../boot/dts/qcom/msm8916-samsung-on7.dts | 69 +++++++++++++++++++ arch/arm64/configs/msm8916_defconfig | 2 + 2 files changed, 71 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts index 0ff5778a5b373b..59e60f6ae1a715 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts @@ -117,12 +117,56 @@ pinctrl-names = "default"; }; }; + + reg_lcd: regulator-lcd { + compatible = "regulator-fixed"; + regulator-name = "lcd"; + regulator-min-microvolt = <2100000>; + regulator-max-microvolt = <2100000>; + + gpio = <&tlmm 16 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-names = "default"; + pinctrl-0 = <&lcd_en_default>; + }; }; &blsp_uart2 { status = "okay"; }; +&mdss_dsi0 { + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&mdss_default>; + pinctrl-1 = <&mdss_sleep>; + + panel@0 { + compatible = "samsung,s6d7aa0x62-bv050hdm"; + reg = <0>; + + lcd-supply = <®_lcd>; + vpos-supply = <®_lcd_vpos>; + vneg-supply = <®_lcd_vneg>; + reset-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; + }; +}; + +&mdss_dsi0_out { + data-lanes = <0 1 2 3>; + remote-endpoint = <&panel_in>; +}; + +&mdss { + status = "okay"; +}; + &pm8916_resin { linux,code = ; status = "okay"; @@ -187,6 +231,31 @@ bias-disable; }; + lcd_en_default: lcd-en-default { + pins = "gpio16"; + function = "gpio"; + + drive-strength = <2>; + bias-disable; + }; + + mdss { + mdss_default: mdss-default { + pins = "gpio25"; + function = "gpio"; + + drive-strength = <8>; + bias-disable; + }; + mdss_sleep: mdss-sleep { + pins = "gpio25"; + function = "gpio"; + + drive-strength = <2>; + bias-pull-down; + }; + }; + muic_i2c_default: muic-i2c-default-state { pins = "gpio105", "gpio106"; function = "gpio"; diff --git a/arch/arm64/configs/msm8916_defconfig b/arch/arm64/configs/msm8916_defconfig index bea30b49e95018..97a136a8a17310 100644 --- a/arch/arm64/configs/msm8916_defconfig +++ b/arch/arm64/configs/msm8916_defconfig @@ -279,6 +279,8 @@ CONFIG_DRM_MSM=m # CONFIG_DRM_MSM_DSI_10NM_PHY is not set # CONFIG_DRM_MSM_DSI_7NM_PHY is not set # CONFIG_DRM_MSM_HDMI is not set +CONFIG_DRM_PANEL_SIMPLE=m +CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0X62_BV050HDM=m CONFIG_DRM_PANEL_SAMSUNG_S6E88A0_AMS452EF01=m CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0=m CONFIG_DRM_PANEL_SIMPLE=m From 5a64127f17e835e5cd00371c8e2d7cc9acd4ebfb Mon Sep 17 00:00:00 2001 From: Jasper Korten Date: Wed, 17 Jul 2024 22:47:09 +0200 Subject: [PATCH 4/5] arch: arm64: dts: qcom: msm8916-samsung-on7: replace muic nodes with pm8916 equivalent --- .../boot/dts/qcom/msm8916-samsung-on7.dts | 70 ++++++++++--------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts index 59e60f6ae1a715..73e8f6a2d5d61d 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts @@ -95,28 +95,28 @@ }; }; - i2c-muic { - compatible = "i2c-gpio"; - sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; - scl-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + // i2c-muic { + // compatible = "i2c-gpio"; + // sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + // scl-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; - pinctrl-0 = <&muic_i2c_default>; - pinctrl-names = "default"; + // pinctrl-0 = <&muic_i2c_default>; + // pinctrl-names = "default"; - #address-cells = <1>; - #size-cells = <0>; + // #address-cells = <1>; + // #size-cells = <0>; - muic: extcon@25 { - compatible = "siliconmitus,sm5703-muic"; - reg = <0x25>; + // muic: extcon@25 { + // compatible = "siliconmitus,sm5703-muic"; + // reg = <0x25>; - interrupt-parent = <&tlmm>; - interrupts = <12 IRQ_TYPE_EDGE_FALLING>; + // interrupt-parent = <&tlmm>; + // interrupts = <12 IRQ_TYPE_EDGE_FALLING>; - pinctrl-0 = <&muic_int_default>; - pinctrl-names = "default"; - }; - }; + // pinctrl-0 = <&muic_int_default>; + // pinctrl-names = "default"; + // }; + // }; reg_lcd: regulator-lcd { compatible = "regulator-fixed"; @@ -172,6 +172,11 @@ status = "okay"; }; +/* FIXME: Replace with SM5703 MUIC when driver is fixed */ +&pm8916_usbin { + status = "okay"; +}; + &sdhc_1 { status = "okay"; }; @@ -187,12 +192,13 @@ }; &usb { - extcon = <&muic>, <&muic>; + dr_mode = "peripheral"; + extcon = <&pm8916_usbin>; status = "okay"; }; &usb_hs_phy { - extcon = <&muic>; + extcon = <&pm8916_usbin>; }; &venus { @@ -256,19 +262,19 @@ }; }; - muic_i2c_default: muic-i2c-default-state { - pins = "gpio105", "gpio106"; - function = "gpio"; - drive-strength = <2>; - bias-disable; - }; - - muic_int_default: muic-int-default-state { - pins = "gpio12"; - function = "gpio"; - drive-strength = <2>; - bias-disable; - }; + // muic_i2c_default: muic-i2c-default-state { + // pins = "gpio105", "gpio106"; + // function = "gpio"; + // drive-strength = <2>; + // bias-disable; + // }; + + // muic_int_default: muic-int-default-state { + // pins = "gpio12"; + // function = "gpio"; + // drive-strength = <2>; + // bias-disable; + // }; sdc2_cd_default: sdc2-cd-default-state { pins = "gpio38"; From 911094558fe2122a63aa6fe2c3cbd1189d21aa1c Mon Sep 17 00:00:00 2001 From: Jasper Korten Date: Thu, 18 Jul 2024 00:08:42 +0200 Subject: [PATCH 5/5] arm64: dts: qcom: msm8916-samsung-on7: Add backlight node --- .../boot/dts/qcom/msm8916-samsung-on7.dts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts index 73e8f6a2d5d61d..08dd417bca829e 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-on7.dts @@ -71,8 +71,12 @@ compatible = "ti,lm363x-regulator"; enable-gpios = <&tlmm 97 GPIO_ACTIVE_HIGH>, + <&tlmm 98 GPIO_ACTIVE_HIGH>, <&tlmm 120 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&bl_default>; + reg_lcd_vboost: vboost { regulator-name = "lcd_boost"; regulator-min-microvolt = <6000000>; @@ -92,6 +96,17 @@ regulator-max-microvolt = <5500000>; }; }; + + backlight { + compatible = "ti,lm3632-backlight"; + + pwm-names = "lmu-backlight"; + + lcd { + led-sources = <0 1>; + pwm-period = <10000>; + }; + }; }; }; @@ -229,6 +244,14 @@ bias-pull-up; }; + bl_default: bl-default { + pins = "gpio97", "gpio98", "gpio120"; + function = "gpio"; + + drive-strength = <2>; + bias-disable; + }; + bl_i2c_default: bl-i2c-default { pins = "gpio101", "gpio102"; function = "gpio";