From patchwork Tue Jun 18 13:59:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805327 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E5BF155CAE; Tue, 18 Jun 2024 13:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719193; cv=none; b=cAM4Ysz918iOdjSHLTGTLSEkz2GLZyYQxvxGgPH8A2i+B8ucjuWUDmIo14SaqontV64XmnNKlOvDPMopO2niC/GOa6Xw8rR7Wpi/fMy1B/5B3x/+e0p+WFHZrxFxwQUGgv/EqqgM/A7oC7fJFdgZUpCliVKGkmYcseboPgSfQ8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719193; c=relaxed/simple; bh=MYDk+LYjEzzvLPDU6mjzpg2IX7z/HKPNPkCElkRcQ+w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KH7vc6RyxUGooCkgEmbeZZ7qKfAJVV9kj65sgPDglB5zS8K5w9PUGDqHZ4weQbR4fynU3c41w/kgMRVMFBxY3mw7du+bq/6naZ2OaTtm+rwd56akgcnKdmP1TawWRiRkjfHlxgKZyspoGN701qStkvsVTodz6Py/nZsfAQY4P/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=i34RMu67; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i34RMu67" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-57c83100c5fso5996215a12.3; Tue, 18 Jun 2024 06:59:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719189; x=1719323989; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CSe0urafDT2z1+HpSSV03N11tNgqTMkBCf6I1SbHXSY=; b=i34RMu67dIPdpECRsvigUcKKEInnayN4bROVrpvKxESQSuSyBc1W+pPJB4YDfvsFrc +FvBXhLsgjGxco2v77LNkUqXbJZ5gGA2RahB+dDCqbijU8Jgh0wt2Mjc3c2YUPXlS2Rx K3cf+ZvaAXrjlu2iiLijVHSl9pauv7hyOEqKyn1GpvqVoBrBiMewrZxK3jluF4Mky8bT Hh7V2Do8pUhZEuiSTw/21c5c2ueA7oyqTOAQ5EQlod2zFlPKTs9ziGaDz1YIsGPQ/8og +AVzMgEQnXNkoZZR+o5yH9D3+TQAuxBJK+WLytDvj6EKMI1InixOOeep7ILea4YDvoRc /5dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719189; x=1719323989; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CSe0urafDT2z1+HpSSV03N11tNgqTMkBCf6I1SbHXSY=; b=uwsaVzi52GsO99Kgddd1qzyHSZIEPHQgppruJc33/5SEvqbrnqqnWR4ZoHl6A4G5i6 2z1yIe2EVUQq2rBYCnGBhAX71OqaUnap9RJy4aNuS4/U4+bDcY3JQBmrHcSWLGf51xa2 ZoXAjmndPrh1l/DgAGtQJ81PxjACEYPkkWRhHwf0Cp65k1CEoYI44e3Gv5zHaxxxpZHU amZD3e/W+jYlbqw6Rz+NmMiIknCyIgkrP+O9GfphiWxz860VUPpz5dzAG6w4oPf35WQi JK9E0a3vmFOotntuk7vO3Np9YPMaspaAxVTzKs422vPvR/mryhWj9oU8GU8sFn/uSkqe et9Q== X-Forwarded-Encrypted: i=1; AJvYcCUP7N/Leyy0VCxAHYbacNpdD+Q7KJC0D1xzXeOoAIa6WGpDHfeMKf7Sag2A3zTrAObpkvKW0cpnsHXDorBwlra1IMj5ZYUrIrzgv7idYQ9EI9XK2C6zNAs2IcEQ1/bebxw0SzMDFmZiD0J5j7SZykVN4M0q6/XMJWhMgViGqx2yBxrD+wBIWuWi8kpGG1k26WRkQ7KJ9VERUcLaxfAALL0HVRWbZIuazoQ270bbMmihTvfoGhDwVWoR7a+icf4hbFd+eGMG/CV5Js9Wc2GO4uP4IumoNA5NKwFGlM74k0cJx83wRd2rNa+6g2j83O4q4GQJqkU+2o1g1Fgf7e1cy8aHpCSSTxv/he0SLLIrmhxCIBMy2/qf9kjBnKoCcnHendV4ex6YKWKxqowMvm1C/YkaYU1eLsUg X-Gm-Message-State: AOJu0YxhvBmFutbCmsJlIpPwLWx1y7MsJq57Q+6Z4uVUc+ufk0mPJ6Cl e66+p22vpdhn2eJJHe63A1LdnF9oelMih/0srnJZl7/f7zAbJWsb X-Google-Smtp-Source: AGHT+IGvN7W/J9F3YIuria+CV3PGWcs1VK3Ax+ln3/ipL9AA6AsOYEJMmxSCCBizSSU6Q6We2LB81g== X-Received: by 2002:aa7:c253:0:b0:57c:ce20:152b with SMTP id 4fb4d7f45d1cf-57cce20164dmr5541095a12.26.1718719189451; Tue, 18 Jun 2024 06:59:49 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.06.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 06:59:49 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:35 +0300 Subject: [PATCH v3 01/23] power: supply: add undervoltage health status property Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-1-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=718; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=MYDk+LYjEzzvLPDU6mjzpg2IX7z/HKPNPkCElkRcQ+w=; b=6osR5sQb3KfAqZxw/zABeeghkZzuowKR+l9GQi+0gqppa+51FZOCldCtLrCOr+cODyhyepNtO Beikk3e7TQ8CKJCAPvaKcz8UpsfsQfaQyB+QH3eRgK0LKT1K32tsI9K X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add POWER_SUPPLY_HEALTH_UNDERVOLTAGE status for power supply to report under voltage lockout failures. Signed-off-by: Dzmitry Sankouski --- include/linux/power_supply.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 65082ef75692..0f82a5c0ccf4 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -58,6 +58,7 @@ enum { POWER_SUPPLY_HEALTH_OVERHEAT, POWER_SUPPLY_HEALTH_DEAD, POWER_SUPPLY_HEALTH_OVERVOLTAGE, + POWER_SUPPLY_HEALTH_UNDERVOLTAGE, POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, POWER_SUPPLY_HEALTH_COLD, POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE, From patchwork Tue Jun 18 13:59:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805326 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A11BA13BC3F; Tue, 18 Jun 2024 13:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719197; cv=none; b=EjOrotgHX8j5LewE0hfg3Qe5bkI1kxRtaIhFRF3SppgCosPNQ3xHSNqa81I0hoDiyqAPuD5hzYs0ET6Vea8UXK0zNA+tsh7QiTK+mxIOCtkk0++ixVhZxIncnmgqxmnv7Ar46rdJKwFCnw68gPJc5TjGtx1R+yJSDKN0QRqOJSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719197; c=relaxed/simple; bh=u/o9BG9AqKYLWAUPHxzLUOD2JYdWbpPwReHpmt6QtHE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A50dHY1/5+UT9zPrBN7FP4x1hB5lQ1ZKRDTqTc0RKi6Y892o43S4QFnSOuyBuldTLHosJfsEpTNchZo4XB1ZUA0l5gdrR48nDfbTIUwa7KJewz4n8mBzxN3jrEuj4GfkQe1dCk6YW8/mKAHndOr64f2o/XgcuobGqWGol1FKTQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KrwJ/pwR; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KrwJ/pwR" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a6f51660223so328313766b.0; Tue, 18 Jun 2024 06:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719194; x=1719323994; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hjTOnao2jgs0TbPexQcL6nA3LicQJeUCbeGc7Ge6OXc=; b=KrwJ/pwR8Vtomprnh32p4KwSpFYbigm6FUoffQN2anSjXsOHco+oSCqeGqepD9wTkA /eXn3TiCLOy1hl3+l7ibrSS+sZaIMb9TVOOpgDA38w+WAbvdBDXCo9859zgn2KnIF98A G83bq9PlUEli0ND1fmSfeGBruRzq3YWzzgvGZPDSblAqW2PWpSA9hmuAw2u/SPg8li9U BRwczZB9+c6eE3KO/I833dQZcv+448yDo7iVeDFdCvZqpUWa1bqtNcX1XccPRn/Vbt4M l2io48PhY3Q/DJ4KxdaFr7mXxYbjhPiX1XTyfn+BTdxfXR/RVcL4LWpfbbMk1s0mluAg iwlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719194; x=1719323994; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hjTOnao2jgs0TbPexQcL6nA3LicQJeUCbeGc7Ge6OXc=; b=usqN8PvhlgP8w6uX2MAfPgD4qRVTbOyb4eWG44qAbhs01VWNZ6LrnPa147ecbj/Fhb pDYNpwM4iRyAKO+nEETjvBdfJUwwVXuNULCSt7wekxH7QR55hyS83MaBDv92jiz7zfQN zdfQRssAC9uqUixOdqvmBXate2rAKTunfp1tdL7emZk6XQ2rEdVCOUrbVvNjqk359ir2 nNoTg9X/6E4MlfUhht34vftD3X4YkDaQJNjRsQfYr2a0B4Y7srP+ImXYL920TZbCrjq+ AIcmcU6+MTemyHtiUhA0KPhZcCIHK8OlxpJqB+5EXWTaR034Oc2pmwvporOl/W9Yvlkm 4Saw== X-Forwarded-Encrypted: i=1; AJvYcCVlAk6KyzeWGHlwaD5JDW3ndzKJEg17Tp8XcF9sJc13QLezaZ8F1UnJ466wBMh19enVGQrESU/M99DD/sj6eVZhZW08eurZtc7+w/LWudwmBfM0ckDvabkT4MbsW7dFATH3f4xvGty5KYbj9bhh40rvYlR8MF2RE3/0LZ1PJWrwkP8OqQ4lOospO6WUty/5rT9z8iMs0EPAeepOW0eouDAeuIvt1THPJuM2CBHiLmTtv+dLkcbNPxD0CiHKu7+M/qtnOhaLhpi4MSC2fYpzgeL/34jkD7uT0Uc/3LP8ejYRgrlZ0IgvrKUop116xl8iOQT0utD+AIpNNsJ85l0g20eEewV7cFqhejtV08rzIkoFwdExVcbCyoJqt/A91YP3M4Mh6YCt2GXZ1Pntw+nj2A5CtHJXBp3u X-Gm-Message-State: AOJu0Yw9YAllEd5Z0eHnFsOtlNML5jhvNb44D0dyV818Dvv1Oe7mlF0l snG+CJA37hCe3IOYngKnlQ3TJISyxar7L5tA6a37W/2Y3RSlq9wz X-Google-Smtp-Source: AGHT+IFEcN8FjKFZhcaPR3K37rXFvtBAVhD0dgg++WL+CT9QX+9G7TKsgbcNessmzcPjrqqULcHuug== X-Received: by 2002:a50:96cf:0:b0:57c:6861:d731 with SMTP id 4fb4d7f45d1cf-57cbd6c7457mr9478897a12.28.1718719193759; Tue, 18 Jun 2024 06:59:53 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.06.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 06:59:53 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:37 +0300 Subject: [PATCH v3 03/23] dt-bindings: panel: add Samsung s6e3ha8 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-3-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=2883; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=u/o9BG9AqKYLWAUPHxzLUOD2JYdWbpPwReHpmt6QtHE=; b=g50eS59XNhy8Hz/rQYUxaUeykF5WKEEvQYvtP+VPrwrvnuKg4KD3zx6UKrGwX1D8tekXKo86t ocpTGcK5tVDAVNDxhWjwlgaYobX1nnwFwmG4bfa4toG4sAnckh+ziPk X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add binding for the Samsung s6e3ha8 panel found in the Samsung S9. Signed-off-by: Dzmitry Sankouski --- .../bindings/display/panel/samsung,s6e3ha8.yaml | 76 ++++++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 81 insertions(+) diff --git a/Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml b/Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml new file mode 100644 index 000000000000..9d7d747264dd --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/panel/samsung,s6e3ha8.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung s6e3ha8 AMOLED DSI panel + +description: The s6e3ha8 is a 1440x2960 DPI display panel from Samsung Mobile + Displays (SMD). + +maintainers: + - Dzmitry Sankouski + +allOf: + - $ref: panel-common.yaml# + +properties: + compatible: + const: samsung,s6e3ha8 + + reg: + maxItems: 1 + + reset-gpios: + description: reset gpio + + port: true + + vdd3-supply: + description: VDD regulator + + vci-supply: + description: VCI regulator + + vddr-supply: + description: VDDR regulator + +required: + - compatible + - reset-gpios + - vdd3-supply + - vddr-supply + - vci-supply + +unevaluatedProperties: false + +examples: + - | + #include + + dsi { + #address-cells = <1>; + #size-cells = <0>; + + panel@0 { + compatible = "samsung,s6e3ha8"; + reg = <0>; + vci-supply = <&s2dos05_ldo4>; + vddr-supply = <&s2dos05_buck1>; + vdd3-supply = <&s2dos05_ldo1>; + te-gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>; + reset-gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&sde_dsi_active &sde_te_active_sleep>; + pinctrl-1 = <&sde_dsi_suspend &sde_te_active_sleep>; + pinctrl-names = "default", "sleep"; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index a2f416e4a7c6..fddbd50f7685 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7150,6 +7150,11 @@ S: Maintained F: Documentation/devicetree/bindings/display/panel/samsung,s6d7aa0.yaml F: drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c +DRM DRIVER FOR SAMSUNG S6E3HA8 PANELS +M: Dzmitry Sankouski +S: Maintained +F: Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml + DRM DRIVER FOR SITRONIX ST7586 PANELS M: David Lechner S: Maintained From patchwork Tue Jun 18 13:59:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805325 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E592915B57B; Tue, 18 Jun 2024 13:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719201; cv=none; b=mbZw/eUTmZMZ8MkYl3JBqEeEsXh9A3kU84xaJJwtATMd2C+7oyvYoecQzAqAAC+eU9NYiIE2L+AuyPz8JpcQzBANyo8/ha28G9Z83bPsxATZ0qxgn0J6bqLAGu+w49OnmknPlSQbfFW8uiRV+fLoeLiZb5s6mekO731V2yyU6c4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719201; c=relaxed/simple; bh=qthIpOYuUqEKsnF/WfU6OBlZPhcwRZUIhgo+lk7uE+8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QQ4D6l88F9L82lis5HryKjmqpG7T/+YnqF/w/Yy5Hv3TL9L2FldJAGEL+2/EMzw0iNFsnd38H/eYh109lVBxKa+JsY4SmLLWV18WkGpdrxhWFEF0f/2uQogAmlsSwkWK4rkbyXdU2H2hvFNELJPpoBA7kPjgblU/KLP3NrQ8Lcg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ThSVVksV; arc=none smtp.client-ip=209.85.208.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ThSVVksV" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57a4d7ba501so6833205a12.2; Tue, 18 Jun 2024 06:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719198; x=1719323998; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Upy6fBZOR1H2GEGfXG5Z3nttQhCGYdXb6UIkk48wC28=; b=ThSVVksVQGJZAq+UH9hyafuc9P0hkGXrkPTDjCSHZzGgwWR7cVb1mX92bUuwMI5d5d m7JAa9kwEd3T8IdI+WyEjlDAHaY0sly9i+ijE1NCHp0NNFqk713p7wFwv74tduK9sajR 9ZlROKtieOd6sHQ7Zpf+h9dkFR5bvF/neXcMojxeV0ClYK29qMxHJk3gf1ZIOOKvTLmh 2CPD+v5h4C0kAlTrWP3NKrLkxzPm6sNiTQrPLiQcUh7LMc4tsAvndl9lPRKDgUiNfiKr 7dzbXQg86MXH7+DFBdd1x/bvfXcJ3UDS68E389xPl7rkenCtp0E+zR8/P19iiPJsCzQz UgWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719198; x=1719323998; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Upy6fBZOR1H2GEGfXG5Z3nttQhCGYdXb6UIkk48wC28=; b=lK2KAWteDjFw/d1Jyxe0fn/RJ0Tfb54CXomheJLxmyO8LxV5viF1z4VuTBjG+dgT7i KKKYg7DJqaBruwRX+QSTlsKRkwNMxBLUf9Sdm3Igvfk7gs6JR0oz5Yqfq1ga8zx/ypNR nk6YW8DzT7jlq75gQlvxzH65aTty2STRTbFVhtfjQkZB7DFgwrlLnEUOsGtbSm8MsrA0 eY8Kfnxq/ECXoNG/ItGlNxYbwQ7f8o7QrowDEqUlLaYlO6A4kV48BCrcepnCWFnqqcD5 DsN6/RhcIR7GIeKB/Mir4mRc8OEo8dr/Ldx/H7slo+/FuYo1aJcQcWpbnS8qfaNBYDFp FeHw== X-Forwarded-Encrypted: i=1; AJvYcCUS8A9K/FHkFifdy/2Dc7rftqllfk+frb0XDvdTV/gRlgy3jisINxST4wu/ZbwiE1f3GBBCv49oPWE3Xlwq6LetT7npjGQwVCDDOyCDVCChJS8ytfXNsO3hVbfr980gfW9XR1FFhYYkRCdXFqdS+x07apjRdAkSi49vwMYzywxcUyrHRcs9VR0EPJq2kLwWLy+58EwLGgLiPXT9Fe3k1XCd5D6M9AG39McqQjy8dSKU+M5Nvzy0TuUQltWZTs2syW35A4Uje5dqr+3tDbPWmoojWpbLSvFiwe0P+9q+JRZoW0nNNvkpM+g978+Ug1neZgV3g/G2e+SQjuhRkps7FNonev3bfugmPB9Yk1TVJ59c2DXt99jMYYJF0bluzZWydch3aIkfhLByJfjuD4jq/XIhPfr/LF3G X-Gm-Message-State: AOJu0Yxo3wHNEQON2DN23Xr4xuuKsDV7JAAesO4AP/TVNOIsqbq14gN4 xHWtoflC45rbQB2b1/4MpZkN+qGvhb6xWdCgvjsi5xpJCjnPBy8e X-Google-Smtp-Source: AGHT+IHMqfIH2/+QaLV+rotp1RiZdfhBoayjQhqdenR5458icQCIvicX3Uj89frks5W/jGab9ZLt+Q== X-Received: by 2002:a50:c31b:0:b0:57c:ad11:e755 with SMTP id 4fb4d7f45d1cf-57cbd69c382mr9094793a12.33.1718719198162; Tue, 18 Jun 2024 06:59:58 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.06.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 06:59:57 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:39 +0300 Subject: [PATCH v3 05/23] dt-bindings: input: add maxim,max77705-haptic Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-5-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=1304; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=qthIpOYuUqEKsnF/WfU6OBlZPhcwRZUIhgo+lk7uE+8=; b=wssyoJ3JsY7QOzBApfw3BG68MDFIQFbKUYMtNH4F4598qUtec5ADE8WPLKSmTw5VIE9HxgqOW mZhnDxDmJLQBIDXpX/vHZ8MCzqNHjA8MVN4AIUp8pKkFz6LyoXbwdZX X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= maxim,max77705-haptic is MAX77705 pmic binding part Signed-off-by: Dzmitry Sankouski --- .../devicetree/bindings/input/maxim,max77705.yaml | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Documentation/devicetree/bindings/input/maxim,max77705.yaml b/Documentation/devicetree/bindings/input/maxim,max77705.yaml new file mode 100644 index 000000000000..8f065a2fe7bd --- /dev/null +++ b/Documentation/devicetree/bindings/input/maxim,max77705.yaml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/maxim,max77705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim MAX77705 Companion Power Management IC haptic + +maintainers: + - Dzmitry Sankouski + +description: | + This is a part of device tree bindings for Maxim MAX77705 multi functional device. + + See also Documentation/devicetree/bindings/mfd/maxim,max77705.yaml for + additional information and example. + +properties: + compatible: + const: maxim,max77705-haptic + + haptic-supply: true + + pwms: true + +required: + - compatible + - haptic-supply + - pwms + +additionalProperties: false From patchwork Tue Jun 18 13:59:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805324 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26E4015DBAF; Tue, 18 Jun 2024 14:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719206; cv=none; b=pimzDSjoxa+vn+lJrFWQJY1TTkwSzFJ4kzMCWf/Ib9xo72DznzZd1m+tP/YE2qA60cOfrVLrD4RbmAAatttBV+Rtsn2qLJGNM3lN+mJ2BGPUQ2NiQfsUOoGGPvWEBXeaCJghVPn7CKwmqb/8aHIy9fJtMbTyO8GpClVWA7qN/h0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719206; c=relaxed/simple; bh=kcP4CRKDseKYJTmDRkTK1Kkwp1UjhNtI1X6qAeNdmFk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PWviC1dXG+kUn0uNSLiZRKe1L5N64wYJx4krYoWc1eCw/i0p3L0HgZvDKWRBfsDYWT5RHGX9JllcBqlV9Hlzey8iC78s/sfVDwiZ2d6sghFlsSpjWta0wdnqmelGlzrl+CBruZIots8tneB8kP7BRt4wOO0SxvGn7pMFKAYp7Bg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XZ/cRBIw; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XZ/cRBIw" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-57c714a1e24so6223120a12.2; Tue, 18 Jun 2024 07:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719203; x=1719324003; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=DAPyRIfn0zoFYR6H5DZfvZ7lLQ098EkhxsFz4D8wcf4=; b=XZ/cRBIwH/nW8ieZhABkNJQJDbiZ3xfORQdCkem+Fnm3ZYdzJQJCdRX0Vzog0AXpbb XDUMibdz3gi05FSN8UNJZBl4ZR9Y8RHUL4S+5xhyi0SGh6PSzZbQanacmYdeklV9EAAB 92yWXSMdqjqEgjNA0qdlda9I/RWM4Fh4zovZ213ppdzWa495hDMAQIPYH2A5VACMlm24 eqXcsI4avA6bJrQTKlhb1ViC5Sd3sUG8mBsaYNKPgSU6bm9bAbuPPwg78wYmtHMlF3IO CgMjYzpnvshVgHboRCrZ3ELyREuREW93LmJ0NV4bAE0NzrMqLNKzVUXKKWwRDu8MwR3q 5/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719203; x=1719324003; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DAPyRIfn0zoFYR6H5DZfvZ7lLQ098EkhxsFz4D8wcf4=; b=e3kCusskxE25UWoReVS76cBfVcYLyWlt7l5xgD64rHh+XVVGTgXbf2mvpd1gY5HYzq DuK0CdHk4K+O4DX9ls6H5Y0ASW3ZISSt8Ld/uo0FflOc/WSJvic4vJskYmf4s93GmrGO g0NchBkgTr0wD3tQlkHSU4bgGvTqG6NieXyVvvuJXLVTYr5evu/UD9oyGGJBoMPcASRV K7RgLekcx6WVpK23pDpCv07XI/gR0x9cpGeCBH3BZWiMQ1gwSRGD1A0OTFXf51CBe5Fc mQ4fH+foVB6plYcyRz06LYL2uJ9ac5kihZqmD7COcBVU7oaqQkP54zYqqKVlBN+62+iU QagQ== X-Forwarded-Encrypted: i=1; AJvYcCWNhNOqC3Eou/SGvCR+4gNRrWV3cny2aDGpuiURPPCsVzon1XHxshZYqsP2c2seUu3UONCV2OnBOvClb0z9NQjrFC0YB6NO0x8IKLpqPfKXh7yeWj3uUpO9sshAeK9ZJSMFl8i5M+NvWBPJMjbD6mrG+RfHTopnfXw06ha2Yax0LbSxZKF+5eiyCiNIlkn9V+kE6fIir8RMlJz3wmQn877SsYMskuCor/d0wqOupk7IqMqdKrlWFMaPsmMCOcHcPCK63QnrslP2LzRmp8KU0wa5xNyhvBCeD1nOg892bvfB/qoZwSrXJs7s8RlIdfvFSEbT50PEi5s1unwJrULBI/Ly1PeXfqpanbfFJxo5zxcSn1BFVLCSA1UTjUzhvO9zioNViThNoi/kleuaemqQ2v5n2nqZDb5J X-Gm-Message-State: AOJu0Yz0NY6jU9kSaH6BgscA4jgya53UtzFZoen66RUYyZyW4hdwqZNV G7uSw3yrza98jXW7/0Ou65y1el+HMWYChhbCqZNMrSLqQFIpMlJc X-Google-Smtp-Source: AGHT+IG+4lLZCtVPgURwIdcirf4nRr/hvjtf29y9VmITCHT3oab1SqgnU6wHrBAh8A/Xff1ksbBLsA== X-Received: by 2002:a50:9f8c:0:b0:57c:73ff:d13e with SMTP id 4fb4d7f45d1cf-57cbd8b9c60mr7324128a12.31.1718719202882; Tue, 18 Jun 2024 07:00:02 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:02 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:41 +0300 Subject: [PATCH v3 07/23] dt-bindings: power: supply: add maxim,max77705 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-7-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=1491; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=kcP4CRKDseKYJTmDRkTK1Kkwp1UjhNtI1X6qAeNdmFk=; b=/cukwzpYHF5iN3FfFAFfgniEdjw64YdmmzDzpAuzFjD3j6+McSzPALs9l5MdhIDFnxkIqnEyv 8YlqGe2NodRB8QMkSwE+giD0jR5APPEnJte16G5TK7KUZcHwrklY4zl X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= add maxim,max77705 fuel gauge binding part Signed-off-by: Dzmitry Sankouski --- .../bindings/power/supply/maxim,max77705-fg.yaml | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max77705-fg.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max77705-fg.yaml new file mode 100644 index 000000000000..b24db0aba0d7 --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/maxim,max77705-fg.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/maxim,max77705-fg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim MAX77705 Companion Power Management IC fuelgauge + +maintainers: + - Dzmitry Sankouski + +description: | + This is a part of device tree bindings for Maxim MAX77705 multi functional device. + + MAX77705 fuelgauge with ModelGauge m5 EZ algorithm support. + + See also Documentation/devicetree/bindings/mfd/maxim,max77705.yaml for + additional information and example. + +allOf: + - $ref: power-supply.yaml# + +properties: + compatible: + const: maxim,max77705-fg + + rsense: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Sense resistor value in mOhm + +required: + - compatible + +additionalProperties: false From patchwork Tue Jun 18 13:59:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805323 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1912815ECF9; Tue, 18 Jun 2024 14:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719210; cv=none; b=BJsnc0JU1vf5OOBmIUpddwsRGx322QMdy8fGItwp112rg+onYLoVErtqSx8TQPofqHI2Iu5NwksMQKzq2PFYBfQreXddGFlv5RfZHyhyyfUZVp7N08vKgKcFybbVzodjJ0C9iESzYVHZ4DdtyIAjUbMvWb3zw8tyzzAa95Bgm+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719210; c=relaxed/simple; bh=GeSjdBMrPx5/NgT7rDPKCihsvNHSXF0w4Z/AktYQJMg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZbakU9RhvT8plVKz/tF1MxBboj7uqqmWFLZQTNnqZ9+F0CoaNNzi81TuvtZZ8tJc2p7evceWtumGuD4yLVrdBSyU4lmGikw1/detSh0U0ktGIqForSSu5W53Op/Gba8tApDiTfN36jjXFBoEd5KqWjDYRQkt9kdFrnr2B7sHRU0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HVuYx68U; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HVuYx68U" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-57c75464e77so6758003a12.0; Tue, 18 Jun 2024 07:00:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719207; x=1719324007; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=evq88jlvU8RulgmUy64jbhNijl81dqHkwYkJ8InB99k=; b=HVuYx68UIYBqOvBHiK7st63eHkHDVCbdXNh5qVZiAO9qYbdiCzSJ3cUbQZJ3rUWP22 AouRSei1OjHsvJlV7aRv254ROq1CpS7L/63TSRJcMhSN1RMop0oPUqbfIijpVFaw8kIa 3iaxELgv0OM0jl0izVvua4mHi6/rI5ZDv24NlGfEQcfVXbV36VACBed/OaUhKOC2tzVd FotEtmX0R7r2Bwi+CPRogyjnjxThK4ktPIcivp6ql0UHXByszkxuvQEcVsTscbbCfoMm 0C+PpCk2P92lcJsVirMwsSQSk7iQ8QPgZgZqGgKyD2CRvTROuHqpPHSPn/VsZo+qaJNV PHig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719207; x=1719324007; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=evq88jlvU8RulgmUy64jbhNijl81dqHkwYkJ8InB99k=; b=SWP1zma0XJYCPFI5laLnYrb9WLMLJX1au4yF8B4ZapI7JWCy65IA0q91O83ENQgCzO 3ZSMsRFWkcmHBv+fzqxemRWHXhv3mS+kgYk0RogCxh2/tCy9QCSA7SqqJNRqutMmyTgT ox8oUB0YEt5+CgE1LGb3Hi38zzGo4wQzcwvYqZYPjPoFh74HrKB/PaiFZRZYU9RuOzrB pWgAoJ+y7zEuR8bKwojkBWbVCinsysGRf0goElt/NB8rOyAZsTAkYS239MGlKl5/IIF+ hLOvVrEjBaRbvhkGFpXiE/C3iNsbEX/ZDLTdmNU6WwpPdc2cKz77pNWOZqAHEak93EFr t6KQ== X-Forwarded-Encrypted: i=1; AJvYcCW+6pcXnNXnWNxAuEFRqjSylG/WSetk8RtaVnvrO+a24OB5cuP0MsICI7u1dGcLVpNnXWC+V1cCixKXSbqXXQ98vJs9fD9tFXExFsDB4jlOiDfHMDhqtaljITAhluWDAEmudu4nITY897rEBqg55NpyPPNembZyK1jLqf7ND7ZHeAWbgap18kDj7YG/TvsOk0ZC5ZllrncciNIOw0AbckhlHgyPhoKHsqklQAQG/0PvzdyadmzniQPPs62h8Khq25H4LcQtD7zqe3KRlZAaXhUWWEeXbqtTbueDbka/fqfpTAS87t2J4DFVSOOBIk96ko9XTOKTtVfmxL2Je2PStIxAtyqhcXy4kP+7tG7+dDhfoi/N65qgB0hZ8TU+N79pRUoSegJlAX99yY2mG5r5LF31vQZlrRDx X-Gm-Message-State: AOJu0YxMHojX3xqlzG59AUj3Hi+oE+8AyTg1LHVhP0/wik2KqvATzHB7 O8ThCJNlgyJvjkHOjcwvYBsu5BPGva1zCNnphNG5SStIEyyAuXNd X-Google-Smtp-Source: AGHT+IFilio5qKRl+cSnK8IQn5IAVmutaHGtgF17QZrcOlUnZe/40B0j5GGoC7IbWTgHhNsL8k7V6w== X-Received: by 2002:a50:c19a:0:b0:57c:5f8a:26f8 with SMTP id 4fb4d7f45d1cf-57cbd6c6de0mr9000377a12.27.1718719207284; Tue, 18 Jun 2024 07:00:07 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:07 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:43 +0300 Subject: [PATCH v3 09/23] dt-bindings: mfd: add samsung,s2dos05 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-9-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=3596; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=GeSjdBMrPx5/NgT7rDPKCihsvNHSXF0w4Z/AktYQJMg=; b=SVRUeOlS2AnrVfvyQsE3+BYBfIEGACx1n7IrRdkctMOEdEgjj8rJD4eKceXUvtg1WRJSqgDNd jDU4o7csfmMCaF/woZolPqcOjzIaWS6mIu9Mc9Zuqq3a6UrHbBnN4LU X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= add samsung,s2dos05 core MFD module binding Signed-off-by: Dzmitry Sankouski --- .../devicetree/bindings/mfd/samsung,s2dos05.yaml | 89 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 90 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml new file mode 100644 index 000000000000..f2ef5171cc40 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml @@ -0,0 +1,89 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/samsung,s2dos05.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S2DOS05 Power Management IC + +maintainers: + - Dzmitry Sankouski + +description: + This is a part of device tree bindings for S2M and S5M family of Power + Management IC (PMIC). + + The S2DOS05 is a companion power management IC for the panel and touchscreen + in smart phones. Provides voltage and current regulators and adc for power/current + measurements. + +properties: + compatible: + const: samsung,s2dos05-pmic + + reg: + maxItems: 1 + + regulators: + $ref: /schemas/regulator/samsung,s2dos05.yaml + description: List of regulators and its properties + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@60 { + compatible = "samsung,s2dos05"; + reg = <0x60>; + + regulators { + s2dos05_ldo1: s2dos05-ldo1 { + regulator-name = "s2dos05-ldo1"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <2000000>; + regulator-active-discharge = <0x1>; + }; + + s2dos05_ldo2: s2dos05-ldo2 { + regulator-name = "s2dos05-ldo2"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-active-discharge = <0x1>; + regulator-boot-on; + }; + + s2dos05_ldo3: s2dos05-ldo3 { + regulator-name = "s2dos05-ldo3"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-active-discharge = <0x1>; + regulator-boot-on; + }; + + s2dos05_ldo4: s2dos05-ldo4 { + regulator-name = "s2dos05-ldo4"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3775000>; + regulator-active-discharge = <0x1>; + }; + + s2dos05_buck1: s2dos05-buck1 { + regulator-name = "s2dos05-buck1"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <2100000>; + regulator-active-discharge = <0x1>; + }; + }; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index f008429033c9..3ab41e53c9fc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19897,6 +19897,7 @@ L: linux-samsung-soc@vger.kernel.org S: Maintained B: mailto:linux-samsung-soc@vger.kernel.org F: Documentation/devicetree/bindings/clock/samsung,s2mps11.yaml +F: Documentation/devicetree/bindings/mfd/samsung,s2dos*.yaml F: Documentation/devicetree/bindings/mfd/samsung,s2m*.yaml F: Documentation/devicetree/bindings/mfd/samsung,s5m*.yaml F: Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml From patchwork Tue Jun 18 13:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805322 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AD3D156F55; Tue, 18 Jun 2024 14:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719216; cv=none; b=AAnxqRCGlti6RSb50cBLtoN/setJFX8THDn8YgFjVIM7geT4L5PjPbkeaC8HHAxo8i3sS8SoEIqG6Tu24qQMWSg3iexLNcwq2d6t5zVUsV0LA1+VZ60ntIf0RwEEcPW9WwR+uhUpmARpr5M6ocMeBdvepYX7qv+OykExt+cBwbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719216; c=relaxed/simple; bh=ue3MHT37XXyjNHrxkEj2M0Jd6XrwxyplbB2podMmaEI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YjTTJw2R4kLi7sYKTXEzFiSZ74bPmLO8ME6UMdVNR4NBxStSlXOPtifJvDNpZpSEK8tMnRk6vTFUIpcgJ10c9DeS0MjCjYDAdwzvogcDntsEmU6DGbdSHvLLwwe+5X+kCoxWF5cz0euCV1DY/ZNNt/zxyBC7GBY6OBFdgmsEKvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mLEfz7/0; arc=none smtp.client-ip=209.85.208.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mLEfz7/0" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ebe785b234so54404021fa.1; Tue, 18 Jun 2024 07:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719213; x=1719324013; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=id8Hhvq/bt2h6K3B8/2c/eaipM1A6Vdbe4bbmJMwPG4=; b=mLEfz7/0zeymZ25fXYENu1S6DJpAEKHnqxPkyGkP7R5efYz7ou8/RxNFsvfAZwsRCs st48CKtHpDisUep98tR8PJ6+cxu54GpzBOviZ6G73qK5CxuTWzBsEpLrUSW54j7jMCGR ZcmEdEZaEr+0+sIt3YiSiuHR5RtetDR7hX+ZFd1rIRdoHK0Cx/azutbezYKpNqxzPUgZ 6sx6pN3pWIeRzL7N+b1BvvW6iuYUmK4t8lmzGGJkjroPoLQQf15tlBj3w4hId2blOVku Iuf+LII10Lb6N7I+kCXfMRbhM47kCNbU1FL+z+ll09zfgnSFpzNG+gINU2XE/U8Ox/vG o0Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719213; x=1719324013; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=id8Hhvq/bt2h6K3B8/2c/eaipM1A6Vdbe4bbmJMwPG4=; b=iGQwYHEE6lKg5raGZfg2PRwyYhUEUd2QQuy1kzRSotljzLD7uIyZ2MGgnNJI5j7T36 XROXdAjL1ioaADxbIkngypPzw/+UR9y/8sjBUjUYnMUWJlWhXnYdsbEGMfW5g7nw7WXW xdHRuzW4U1CVhDpI6jCayHpsHxtU8UFhx3FxIUwsioNWgA+6QuCyzRSdLp+rgqubQUdF V38OQtUa3H+icHlmcn7bRN/88KlEpCEV4RWYvWBt5Zsk18H642JZ8DhQ4rSYkE5aWpQk JhNWDNgcJWZc7O8bbq+lV+fi/gab+Rk+TK4SVHZ1ucukV1zoCQPlDYeJXfvP3TtYLXqU TcGg== X-Forwarded-Encrypted: i=1; AJvYcCUrNp/He9YupVom4hrAHJvLodmtM22xG2Ml1evLT2UVD34gmFh26hQ7VdWuTfMHme+uTmFtvIpDFdy9Fz+WaOsDjANWsbhIL1J26c5cd5IoH7KHKy+WKlr9sqqoAOufcPcBXz41iBJsTdpQxoaX6zusL/YnUwllfToGX5d0ak4YN7pT50Jah/CD1j2tJcRQsZ+0s/JeaMJ03hY9r1eTbHVyIshBmtMzAdga64Ufg2lxyBVmloSVNWdgzEi5DIM+dhI7BhNfi8dRoHEz4pwio/mckGwSGOyhyDAPX3Gb5JsY+HG7csSde19LHqd5aE/Mgh8IPeNCh0WLthB4JNJkJACyXFQ6Ta92xunbYyFcZcYIEzpaIyOV6FIStYZKAhSQ+JwoKWI6vb2CxbUGEQ00+YkktDz3nmSx X-Gm-Message-State: AOJu0YzTcEj162wRKwGlUBOb26fH368VVvPoerHiUj7JY0j3y+HNGmYz uYB8qyTM2Wy/gwhkx5iPqLMOWtMT4WpVKNdFTR2warTCbeXxgNKkKRGaN2nM X-Google-Smtp-Source: AGHT+IFGWxNTJWKfvtYtwaUhf5eCQI0VCQBJSAVikp2hNnHlatQzSXBxjfytMltsZ1/pvjUqZscsTQ== X-Received: by 2002:a2e:3519:0:b0:2ec:30ee:6972 with SMTP id 38308e7fff4ca-2ec30ee69b1mr28595351fa.24.1718719212474; Tue, 18 Jun 2024 07:00:12 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:12 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:45 +0300 Subject: [PATCH v3 11/23] drm/panel: Add support for S6E3HA8 panel driver Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-11-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=15491; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=ue3MHT37XXyjNHrxkEj2M0Jd6XrwxyplbB2podMmaEI=; b=jhF8wZ+oXwUHKCr1cjS4cFqpVzhkjkOtp0p6gy65qFozWvPJJ4ZFnD1XBs+P424Y43p0ESGFP XNz3UQCUSTOCQ2MjR042xoIzVbaIvVzVnWtz5BDQCJjsLvwB805bP6R X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for MIPI-DSI based S6E3HA8 AMOLED panel driver. This panel has 1440x2960 resolution, 5.8-inch physical size, and can be found in starqltechn device. Brightness regulation is not yet supported. Signed-off-by: Dzmitry Sankouski --- MAINTAINERS | 1 + drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c | 426 ++++++++++++++++++++++++++ 4 files changed, 435 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 92a5d0a56353..fae3b8ea9ce4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7154,6 +7154,7 @@ DRM DRIVER FOR SAMSUNG S6E3HA8 PANELS M: Dzmitry Sankouski S: Maintained F: Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml +F: drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c DRM DRIVER FOR SITRONIX ST7586 PANELS M: David Lechner diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 2ae0eb0638f3..903fc8c155c0 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -651,6 +651,13 @@ config DRM_PANEL_SAMSUNG_S6E3HA2 depends on BACKLIGHT_CLASS_DEVICE select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E3HA8 + tristate "Samsung S6E3HA8 DSI video mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + config DRM_PANEL_SAMSUNG_S6E63J0X03 tristate "Samsung S6E63J0X03 DSI command mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index f0203f6e02f4..71774cc5820a 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -66,6 +66,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D27A1) += panel-samsung-s6d27a1.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D7AA0) += panel-samsung-s6d7aa0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3FA7) += panel-samsung-s6e3fa7.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA8) += panel-samsung-s6e3ha8.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0_SPI) += panel-samsung-s6e63m0-spi.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c new file mode 100644 index 000000000000..49d629643171 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c @@ -0,0 +1,426 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: + * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2024 Dzmitry Sankouski + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +struct s6e3ha8 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct drm_dsc_config dsc; + struct gpio_desc *reset_gpio; + struct regulator_bulk_data supplies[3]; +}; + +static inline +struct s6e3ha8 *to_s6e3ha8_amb577px01_wqhd(struct drm_panel *panel) +{ + return container_of(panel, struct s6e3ha8, panel); +} + +#define s6e3ha8_call_write_func(ret, func) do { \ + ret = (func); \ + if (ret < 0) \ + return ret; \ +} while (0) + +static int s6e3ha8_test_key_on_lvl1(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0x9f, 0xa5, 0xa5 }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); + return 0; +} + +static int s6e3ha8_test_key_off_lvl1(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0x9f, 0x5a, 0x5a }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); + return 0; +} + +static int s6e3ha8_test_key_on_lvl2(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0xf0, 0x5a, 0x5a }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); +} + +static int s6e3ha8_test_key_off_lvl2(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0xf0, 0xa5, 0xa5 }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); +} + +static int s6e3ha8_test_key_on_lvl3(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0xfc, 0x5a, 0x5a }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); +} + +static int s6e3ha8_test_key_off_lvl3(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0xfc, 0xa5, 0xa5 }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); +} + +static int s6e3ha8_afc_off(struct mipi_dsi_device *dsi) +{ + static const u8 d[] = { 0xe2, 0x00, 0x00 }; + + return mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); + return 0; +} + +static int s6e3ha8_power_on(struct s6e3ha8 *ctx) +{ + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + if (ret < 0) + return ret; + + return 0; +} + +static int s6e3ha8_power_off(struct s6e3ha8 *ctx) +{ + return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); +} + +static void s6e3ha8_amb577px01_wqhd_reset(struct s6e3ha8 *ctx) +{ + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + usleep_range(5000, 6000); + gpiod_set_value_cansleep(ctx->reset_gpio, 0); + usleep_range(5000, 6000); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + usleep_range(5000, 6000); +} + +static int s6e3ha8_amb577px01_wqhd_on(struct s6e3ha8 *ctx) +{ + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + int ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + s6e3ha8_test_key_on_lvl1(dsi); + s6e3ha8_test_key_on_lvl2(dsi); + + ret = mipi_dsi_compression_mode(dsi, true); + if (ret < 0) { + dev_err(dev, "Failed to set compression mode: %d\n", ret); + return ret; + } + + s6e3ha8_test_key_off_lvl2(dsi); + + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); + if (ret < 0) { + dev_err(dev, "Failed to exit sleep mode: %d\n", ret); + return ret; + } + usleep_range(5000, 6000); + + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xf2, 0x13); + s6e3ha8_test_key_off_lvl2(dsi); + + usleep_range(10000, 11000); + + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xf2, 0x13); + s6e3ha8_test_key_off_lvl2(dsi); + + /* OMOK setting 1 (Initial setting) - Scaler Latch Setting Guide */ + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x07); + /* latch setting 1 : Scaler on/off & address setting & PPS setting -> Image update latch */ + mipi_dsi_generic_write_seq(dsi, 0xf2, 0x3c, 0x10); + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x0b); + /* latch setting 2 : Ratio change mode -> Image update latch */ + mipi_dsi_generic_write_seq(dsi, 0xf2, 0x30); + /* OMOK setting 2 - Seamless setting guide : WQHD */ + mipi_dsi_generic_write_seq(dsi, 0x2a, 0x00, 0x00, 0x05, 0x9f); /* CASET */ + mipi_dsi_generic_write_seq(dsi, 0x2b, 0x00, 0x00, 0x0b, 0x8f); /* PASET */ + mipi_dsi_generic_write_seq(dsi, 0xba, 0x01); /* scaler setup : scaler off */ + s6e3ha8_test_key_off_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0x35, 0x00); /* TE Vsync ON */ + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xed, 0x4c); /* ERR_FG */ + s6e3ha8_test_key_off_lvl2(dsi); + s6e3ha8_test_key_on_lvl3(dsi); + /* FFC Setting 897.6Mbps */ + mipi_dsi_generic_write_seq(dsi, 0xc5, 0x0d, 0x10, 0xb4, 0x3e, 0x01); + s6e3ha8_test_key_off_lvl3(dsi); + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xb9, + 0x00, 0xb0, 0x81, 0x09, 0x00, 0x00, 0x00, + 0x11, 0x03); /* TSP HSYNC Setting */ + s6e3ha8_test_key_off_lvl2(dsi); + s6e3ha8_test_key_on_lvl2(dsi); + mipi_dsi_generic_write_seq(dsi, 0xb0, 0x03); + mipi_dsi_generic_write_seq(dsi, 0xf6, 0x43); + s6e3ha8_test_key_off_lvl2(dsi); + s6e3ha8_test_key_on_lvl2(dsi); + /* Brightness condition set */ + mipi_dsi_generic_write_seq(dsi, 0xca, + 0x07, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x80, 0x80, 0x80, 0x00, 0x00, 0x00); + mipi_dsi_generic_write_seq(dsi, 0xb1, 0x00, 0x0c); /* AID Set : 0% */ + mipi_dsi_generic_write_seq(dsi, 0xb5, + 0x19, 0xdc, 0x16, 0x01, 0x34, 0x67, 0x9a, + 0xcd, 0x01, 0x22, 0x33, 0x44, 0x00, 0x00, + 0x05, 0x55, 0xcc, 0x0c, 0x01, 0x11, 0x11, + 0x10); /* MPS/ELVSS Setting */ + mipi_dsi_generic_write_seq(dsi, 0xf4, 0xeb, 0x28); /* VINT */ + mipi_dsi_generic_write_seq(dsi, 0xf7, 0x03); /* Gamma, LTPS(AID) update */ + s6e3ha8_test_key_off_lvl2(dsi); + s6e3ha8_test_key_off_lvl1(dsi); + + return 0; +} + +static int s6e3ha8_enable(struct drm_panel *panel) +{ + struct s6e3ha8 *ctx = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + int ret; + + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_on_lvl1(dsi)); + s6e3ha8_call_write_func(ret, mipi_dsi_dcs_set_display_on(dsi)); + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_off_lvl1(dsi)); + + return 0; +} + +static int s6e3ha8_disable(struct drm_panel *panel) +{ + struct s6e3ha8 *ctx = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + int ret; + + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_on_lvl1(dsi)); + s6e3ha8_call_write_func(ret, mipi_dsi_dcs_set_display_off(dsi)); + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_off_lvl1(dsi)); + msleep(20); + + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_on_lvl2(dsi)); + s6e3ha8_call_write_func(ret, s6e3ha8_afc_off(dsi)); + s6e3ha8_call_write_func(ret, s6e3ha8_test_key_off_lvl2(dsi)); + + msleep(160); + + return 0; +} + +static int s6e3ha8_amb577px01_wqhd_prepare(struct drm_panel *panel) +{ + struct s6e3ha8 *ctx = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + struct device *dev = &dsi->dev; + struct drm_dsc_picture_parameter_set pps; + int ret; + + s6e3ha8_power_on(ctx); + msleep(120); + s6e3ha8_amb577px01_wqhd_reset(ctx); + ret = s6e3ha8_amb577px01_wqhd_on(ctx); + + if (ret < 0) { + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + goto err; + } + + drm_dsc_pps_payload_pack(&pps, &ctx->dsc); + + s6e3ha8_test_key_on_lvl1(dsi); + ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps); + if (ret < 0) { + dev_err(panel->dev, "failed to transmit PPS: %d\n", ret); + return ret; + } + s6e3ha8_test_key_off_lvl1(dsi); + + ret = mipi_dsi_compression_mode(ctx->dsi, true); + if (ret < 0) { + dev_err(dev, "failed to enable compression mode: %d\n", ret); + return ret; + } + + + msleep(28); + + return 0; +err: + s6e3ha8_power_off(ctx); + return ret; +} + +static int s6e3ha8_amb577px01_wqhd_unprepare(struct drm_panel *panel) +{ + struct s6e3ha8 *ctx = to_s6e3ha8_amb577px01_wqhd(panel); + + return s6e3ha8_power_off(ctx); +} + +static const struct drm_display_mode s6e3ha8_amb577px01_wqhd_mode = { + .clock = (1440 + 116 + 44 + 120) * (2960 + 120 + 80 + 124) * 60 / 1000, + .hdisplay = 1440, + .hsync_start = 1440 + 116, + .hsync_end = 1440 + 116 + 44, + .htotal = 1440 + 116 + 44 + 120, + .vdisplay = 2960, + .vsync_start = 2960 + 120, + .vsync_end = 2960 + 120 + 80, + .vtotal = 2960 + 120 + 80 + 124, + .width_mm = 64, + .height_mm = 132, +}; + +static int s6e3ha8_amb577px01_wqhd_get_modes(struct drm_panel *panel, + struct drm_connector *connector) +{ + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(connector->dev, &s6e3ha8_amb577px01_wqhd_mode); + if (!mode) + return -ENOMEM; + + drm_mode_set_name(mode); + + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + connector->display_info.width_mm = mode->width_mm; + connector->display_info.height_mm = mode->height_mm; + drm_mode_probed_add(connector, mode); + + return 1; +} + +static const struct drm_panel_funcs s6e3ha8_amb577px01_wqhd_panel_funcs = { + .prepare = s6e3ha8_amb577px01_wqhd_prepare, + .unprepare = s6e3ha8_amb577px01_wqhd_unprepare, + .get_modes = s6e3ha8_amb577px01_wqhd_get_modes, + .enable = s6e3ha8_enable, + .disable = s6e3ha8_disable, +}; + +static int s6e3ha8_amb577px01_wqhd_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct s6e3ha8 *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->supplies[0].supply = "vdd3"; + ctx->supplies[1].supply = "vci"; + ctx->supplies[2].supply = "vddr"; + + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), + ctx->supplies); + if (ret < 0) { + dev_err(dev, "failed to get regulators: %d\n", ret); + return ret; + } + + 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_CLOCK_NON_CONTINUOUS | + MIPI_DSI_MODE_VIDEO_NO_HFP | MIPI_DSI_MODE_VIDEO_NO_HBP | + MIPI_DSI_MODE_VIDEO_NO_HSA | MIPI_DSI_MODE_NO_EOT_PACKET; + + drm_panel_init(&ctx->panel, dev, &s6e3ha8_amb577px01_wqhd_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; + + drm_panel_add(&ctx->panel); + + /* This panel only supports DSC; unconditionally enable it */ + dsi->dsc = &ctx->dsc; + + ctx->dsc.dsc_version_major = 1; + ctx->dsc.dsc_version_minor = 1; + + ctx->dsc.slice_height = 40; + ctx->dsc.slice_width = 720; + WARN_ON(1440 % ctx->dsc.slice_width); + ctx->dsc.slice_count = 1440 / ctx->dsc.slice_width; + ctx->dsc.bits_per_component = 8; + ctx->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */ + ctx->dsc.block_pred_enable = true; + + ret = mipi_dsi_attach(dsi); + if (ret < 0) { + dev_err(dev, "Failed to attach to DSI host: %d\n", ret); + drm_panel_remove(&ctx->panel); + return ret; + } + + return 0; +} + +static void s6e3ha8_amb577px01_wqhd_remove(struct mipi_dsi_device *dsi) +{ + struct s6e3ha8 *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 s6e3ha8_amb577px01_wqhd_of_match[] = { + { .compatible = "samsung,s6e3ha8" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, s6e3ha8_amb577px01_wqhd_of_match); + +static struct mipi_dsi_driver s6e3ha8_amb577px01_wqhd_driver = { + .probe = s6e3ha8_amb577px01_wqhd_probe, + .remove = s6e3ha8_amb577px01_wqhd_remove, + .driver = { + .name = "panel-s6e3ha8", + .of_match_table = s6e3ha8_amb577px01_wqhd_of_match, + }, +}; +module_mipi_dsi_driver(s6e3ha8_amb577px01_wqhd_driver); + +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_DESCRIPTION("DRM driver for S6E3HA8 panel"); +MODULE_LICENSE("GPL"); From patchwork Tue Jun 18 13:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805321 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3386815FCFE; Tue, 18 Jun 2024 14:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719221; cv=none; b=mG+oTrkKcXTJxl3T1FbkBwm7dzC2tiaTLRF4zDNthFwzoSEnZ4pSWsToFP3RMomTEO66TcYynXM7jnEIuUAnNIYq1yOXvnhmWX3Ilm8zyJ6lfhcOhr1R8w5qea4rsCjX9pcOh0UYpZ2rlnbplcbWkFqgKtcjIAF5xMiG/0qMCgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719221; c=relaxed/simple; bh=/5IwQ99bQQRhP1wEuLRjxNnEs6zzgSHLcHa2YEf0U7U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ABCh9U5KvZxN6slryF0ZWhK3GsHmais5N85CGOS9RiQ0p0TKCZH72H7dJefeJchm/7IjpyPUgoEDrB5IlyWp6B3k9A10MLhSSBJHGFK4SHUPA03qx6ObwRx74CaFp412HkYsG++VsgVaaZkjORemaVNG2RFDGOyOWIKfc/Api8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ry7b2TKA; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ry7b2TKA" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-57c83100cb4so6291666a12.1; Tue, 18 Jun 2024 07:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719217; x=1719324017; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Iyl7EIOgIrVaZahoT7LEDslZvULejKLZ0v4aPQDoonI=; b=Ry7b2TKAm1yR5Ryl0s6GIF0YOolM9igb92CEKouivniPhTBsatR5BeP4lrpV+KEbj4 zBVelCfcsw+eFBr1FSwg5JojIU9vnkE9OCJuNMCH1MIbfqfUDAYZytQF65exKd6vFEws wNB7r/MTGFn0bLl7ld8deCRmIreOdEfTUKgVy8PWPuFUclvRpHssvN0aZKN0xMoaZdh7 aCckPh7vAy4b6MmRH0rYEKZMEpujkOg8hFflrZfF7/uWN7VhiWFF3rCYYPBFb8645Gbt 2m0uSXXw1tvjZJqWgUYGhVwCUF1WSTmxqmbhHWBp+oUS+gjb/vAadIdCiPNkh0WjY2YM Bnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719217; x=1719324017; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Iyl7EIOgIrVaZahoT7LEDslZvULejKLZ0v4aPQDoonI=; b=M+1e3/0v+1p11HNtd3CMgJRhosPbxAhZ/D3mtSmdhmxHiY4zpyj1M12hZVTsZ0vWZC Gc8g1jYrW8ATH6bxKf4lhUXYcb/gQ3nPlvkbgK2Pa9ZquGcYtuVTD0PPHOxSuaYLKFNn l9uniil4kvXyNSiiozkfd0U/uP1wPuVywKFpmXMiJ1ufjI5kXhs1t6es5eXtSjpxyY1p uRiJxrV99+2LFoS+mIMQp+3p7/0xJs7BkcmU/craLSUnlYAr1Hco3I5xoh1FqXD/ovR2 InRwbC8jHaV4MvKGcvqq0IWP5iyCpnShzXkIJlZ4kLW7RtKaIjcEa0FlZyIVdt0dLaWf YmOw== X-Forwarded-Encrypted: i=1; AJvYcCUi2HiV/C9tmixniD2/gTyHLV5VdwfC7UIXniTRjCmpf0vzyZdMCM2cYGn/ynGrbE91pbpdBPdopTzOC0LuGaqlt7Paj885iREO8AxmbrEqR12rDE7GAacDI5hGQODojo9zJ1NhPCpFeZ4/ZKM+7JK/ql8B7NeC2JAul2TUl8G+SEgUGZc1JDxfULs+FbZsdoe2Ra8ysbj9M66HyRt9rLeIlf4XqEktMJx8GWdd/VRlPygssZyd6757pEZ521rylVvV0tQrfRURSUTzNkslpMcfxZZKyt9HQM3ilGPuGJDRZqdc6eX8uOSSarf0Yp/25h9GGK4HwRHueisLD/XQzC1BOKwqdGEEHkHgbLrC9/b/24ayLvLNeC4wnePJDflhrZKHLozYUd1pLLLdx7q0hR2X9ywPP/iU X-Gm-Message-State: AOJu0YygOZy9ch78//V+ANnffnC7NPMXpYTIUtz1ugxc6jSfWYFd/B5+ a0QRq5AX3KKyPaqkJmcXCQdhgxzcHS4qccU9e07R+N22NrvZTwCAKPm3agSx X-Google-Smtp-Source: AGHT+IGGllCbRRfBvYmKtKXfQgz30xuR5BJBT8uIwbflUAozAyJ4/JF5SSTi5ZjGzFImDK2lcpqPHA== X-Received: by 2002:a50:c346:0:b0:578:f472:d9d5 with SMTP id 4fb4d7f45d1cf-57cbd906889mr7353992a12.37.1718719217184; Tue, 18 Jun 2024 07:00:17 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:16 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:47 +0300 Subject: [PATCH v3 13/23] input: add max77705 haptic driver Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-13-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719184; l=12244; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=/5IwQ99bQQRhP1wEuLRjxNnEs6zzgSHLcHa2YEf0U7U=; b=IwqH87QADreHlElJVBH5g4BbXvWQGNAdUcyW7w342IefcdtH3+/qzYsds1Feycq0cFdWX/lgJ hLq8aG1QBixAubL/2LUzHO+Svtbe1BLs23uvNyDAmy3jBOGBU0mNcYn X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for haptic controller on MAX77705 Multifunction device. This driver supports external pwm and LRA (Linear Resonant Actuator) motor. User can control the haptic device via force feedback framework. Signed-off-by: Dzmitry Sankouski --- drivers/input/misc/Kconfig | 11 + drivers/input/misc/Makefile | 1 + drivers/input/misc/max77705-haptic.c | 378 +++++++++++++++++++++++++++++++++++ 3 files changed, 390 insertions(+) diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 6ba984d7f0b1..26f7b25a0b42 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -233,6 +233,17 @@ config INPUT_MAX77693_HAPTIC To compile this driver as module, choose M here: the module will be called max77693-haptic. +config INPUT_MAX77705_HAPTIC + tristate "MAXIM MAX77705 haptic controller support" + depends on MFD_MAX77705 && PWM + select INPUT_FF_MEMLESS + help + This option enables support for the haptic controller on + MAXIM MAX77705 chip. + + To compile this driver as module, choose M here: the + module will be called max77705-haptic. + config INPUT_MAX8925_ONKEY tristate "MAX8925 ONKEY support" depends on MFD_MAX8925 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 04296a4abe8e..4dea2720b757 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -51,6 +51,7 @@ obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o obj-$(CONFIG_INPUT_MAX77650_ONKEY) += max77650-onkey.o obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o +obj-$(CONFIG_INPUT_MAX77705_HAPTIC) += max77705-haptic.o obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o obj-$(CONFIG_INPUT_MC13783_PWRBUTTON) += mc13783-pwrbutton.o diff --git a/drivers/input/misc/max77705-haptic.c b/drivers/input/misc/max77705-haptic.c new file mode 100644 index 000000000000..e92dcb4fff37 --- /dev/null +++ b/drivers/input/misc/max77705-haptic.c @@ -0,0 +1,378 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Based on max77693-haptic.c: + * Copyright (C) 2014,2015 Samsung Electronics + * Jaewon Kim + * Krzysztof Kozlowski + * + * Copyright (C) 2024 Dzmitry Sankouski + * + * This program is not provided / owned by Maxim Integrated Products. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_MAGNITUDE_SHIFT 16 + +enum max77705_haptic_motor_type { + MAX77705_HAPTIC_ERM = 0, + MAX77705_HAPTIC_LRA, +}; + +enum max77705_haptic_pulse_mode { + MAX77705_HAPTIC_EXTERNAL_MODE = 0, + MAX77705_HAPTIC_INTERNAL_MODE, +}; + +enum max77705_haptic_pwm_divisor { + MAX77705_HAPTIC_PWM_DIVISOR_32 = 0, + MAX77705_HAPTIC_PWM_DIVISOR_64, + MAX77705_HAPTIC_PWM_DIVISOR_128, + MAX77705_HAPTIC_PWM_DIVISOR_256, +}; + +struct max77705_haptic { + enum max77705_types dev_type; + + struct regmap *regmap_pmic; + struct regmap *regmap_haptic; + struct device *dev; + struct input_dev *input_dev; + struct pwm_device *pwm_dev; + struct regulator *motor_reg; + + bool enabled; + bool suspend_state; + unsigned int magnitude; + unsigned int pwm_duty; + enum max77705_haptic_motor_type type; + enum max77705_haptic_pulse_mode mode; + + struct work_struct work; +}; + +static int max77705_haptic_set_duty_cycle(struct max77705_haptic *haptic) +{ + struct pwm_args pargs; + int delta; + int error; + + pwm_get_args(haptic->pwm_dev, &pargs); + delta = (pargs.period + haptic->pwm_duty) / 2; + error = pwm_config(haptic->pwm_dev, delta, pargs.period); + if (error) { + dev_err(haptic->dev, "failed to configure pwm: %d\n", error); + return error; + } + + return 0; +} + +static int max77705_haptic_bias(struct max77705_haptic *haptic, bool on) +{ + int error; + + error = regmap_update_bits(haptic->regmap_haptic, + MAX77705_PMIC_REG_MAINCTRL1, + MAX77705_MAINCTRL1_BIASEN_MASK, + on << MAX77705_MAINCTRL1_BIASEN_SHIFT); + + if (error) { + dev_err(haptic->dev, "failed to %s bias: %d\n", + on ? "enable" : "disable", error); + return error; + } + + return 0; +} + +static int max77705_haptic_configure(struct max77705_haptic *haptic, + bool enable) +{ + unsigned int value, config_reg; + int error; + + value = ((haptic->type << MAX77705_CONFIG2_MODE_SHIFT) | + (enable << MAX77705_CONFIG2_MEN_SHIFT) | + (haptic->mode << MAX77705_CONFIG2_HTYP_SHIFT) | + MAX77705_HAPTIC_PWM_DIVISOR_128); + config_reg = MAX77705_PMIC_REG_MCONFIG; + + error = regmap_write(haptic->regmap_haptic, + config_reg, value); + if (error) { + dev_err(haptic->dev, + "failed to update haptic config: %d\n", error); + return error; + } + + return 0; +} + +static void max77705_haptic_enable(struct max77705_haptic *haptic) +{ + int error; + + if (haptic->enabled) + return; + + error = pwm_enable(haptic->pwm_dev); + if (error) { + dev_err(haptic->dev, + "failed to enable haptic pwm device: %d\n", error); + return; + } + + error = max77705_haptic_configure(haptic, true); + if (error) + goto err_enable_config; + + haptic->enabled = true; + + return; + +err_enable_config: + pwm_disable(haptic->pwm_dev); +} + +static void max77705_haptic_disable(struct max77705_haptic *haptic) +{ + int error; + + if (!haptic->enabled) + return; + + error = max77705_haptic_configure(haptic, false); + if (error) + return; + + pwm_disable(haptic->pwm_dev); + haptic->enabled = false; +} + +static void max77705_haptic_play_work(struct work_struct *work) +{ + struct max77705_haptic *haptic = + container_of(work, struct max77705_haptic, work); + int error; + + error = max77705_haptic_set_duty_cycle(haptic); + if (error) { + dev_err(haptic->dev, "failed to set duty cycle: %d\n", error); + return; + } + + if (haptic->magnitude) + max77705_haptic_enable(haptic); + else + max77705_haptic_disable(haptic); +} + +static int max77705_haptic_play_effect(struct input_dev *dev, void *data, + struct ff_effect *effect) +{ + struct max77705_haptic *haptic = input_get_drvdata(dev); + struct pwm_args pargs; + u64 period_mag_multi; + + haptic->magnitude = effect->u.rumble.strong_magnitude; + if (!haptic->magnitude) + haptic->magnitude = effect->u.rumble.weak_magnitude; + + /* + * The magnitude comes from force-feedback interface. + * The formula to convert magnitude to pwm_duty as follows: + * - pwm_duty = (magnitude * pwm_period) / MAX_MAGNITUDE(0xFFFF) + */ + pr_info("magnitude: %d(%x)", haptic->magnitude, haptic->magnitude); + pwm_get_args(haptic->pwm_dev, &pargs); + period_mag_multi = (u64)pargs.period * haptic->magnitude; + haptic->pwm_duty = (unsigned int)(period_mag_multi >> + MAX_MAGNITUDE_SHIFT); + + schedule_work(&haptic->work); + + return 0; +} + +static int max77705_haptic_open(struct input_dev *dev) +{ + struct max77705_haptic *haptic = input_get_drvdata(dev); + int error; + + error = max77705_haptic_bias(haptic, true); + if (error) + return error; + + error = regulator_enable(haptic->motor_reg); + if (error) { + dev_err(haptic->dev, + "failed to enable regulator: %d\n", error); + return error; + } + + return 0; +} + +static void max77705_haptic_close(struct input_dev *dev) +{ + struct max77705_haptic *haptic = input_get_drvdata(dev); + int error; + + cancel_work_sync(&haptic->work); + max77705_haptic_disable(haptic); + + error = regulator_disable(haptic->motor_reg); + if (error) + dev_err(haptic->dev, + "failed to disable regulator: %d\n", error); + + max77705_haptic_bias(haptic, false); +} + +static int max77705_haptic_probe(struct platform_device *pdev) +{ + struct max77705_dev *max77705 = dev_get_drvdata(pdev->dev.parent); + struct max77705_haptic *haptic; + int error; + + haptic = devm_kzalloc(&pdev->dev, sizeof(*haptic), GFP_KERNEL); + if (!haptic) + return -ENOMEM; + + haptic->regmap_pmic = max77705->regmap; + haptic->dev = &pdev->dev; + haptic->type = MAX77705_HAPTIC_LRA; + haptic->mode = MAX77705_HAPTIC_EXTERNAL_MODE; + haptic->suspend_state = false; + + /* Variant-specific init */ + haptic->dev_type = max77705->type; + haptic->regmap_haptic = max77705->regmap; + + INIT_WORK(&haptic->work, max77705_haptic_play_work); + + /* Get pwm and regulatot for haptic device */ + haptic->pwm_dev = devm_pwm_get(&pdev->dev, NULL); + if (IS_ERR(haptic->pwm_dev)) { + dev_err(&pdev->dev, "failed to get pwm device\n"); + return PTR_ERR(haptic->pwm_dev); + } + + /* + * FIXME: pwm_apply_args() should be removed when switching to the + * atomic PWM API. + */ + pwm_apply_args(haptic->pwm_dev); + + haptic->motor_reg = devm_regulator_get(&pdev->dev, "haptic"); + if (IS_ERR(haptic->motor_reg)) { + dev_err(&pdev->dev, "failed to get regulator\n"); + return PTR_ERR(haptic->motor_reg); + } + + /* Initialize input device for haptic device */ + haptic->input_dev = devm_input_allocate_device(&pdev->dev); + if (!haptic->input_dev) { + dev_err(&pdev->dev, "failed to allocate input device\n"); + return -ENOMEM; + } + + haptic->input_dev->name = "max77705-haptic"; + haptic->input_dev->id.version = 1; + haptic->input_dev->dev.parent = &pdev->dev; + haptic->input_dev->open = max77705_haptic_open; + haptic->input_dev->close = max77705_haptic_close; + input_set_drvdata(haptic->input_dev, haptic); + input_set_capability(haptic->input_dev, EV_FF, FF_RUMBLE); + + error = input_ff_create_memless(haptic->input_dev, NULL, + max77705_haptic_play_effect); + if (error) { + dev_err(&pdev->dev, "failed to create force-feedback\n"); + return error; + } + + error = input_register_device(haptic->input_dev); + if (error) { + dev_err(&pdev->dev, "failed to register input device\n"); + return error; + } + + platform_set_drvdata(pdev, haptic); + + return 0; +} + +static void max77705_haptic_remove(struct platform_device *pdev) +{ + struct max77705_haptic *haptic = platform_get_drvdata(pdev); + + if (haptic->enabled) + max77705_haptic_disable(haptic); +} + +static int max77705_haptic_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct max77705_haptic *haptic = platform_get_drvdata(pdev); + + if (haptic->enabled) { + max77705_haptic_disable(haptic); + haptic->suspend_state = true; + } + + return 0; +} + +static int max77705_haptic_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct max77705_haptic *haptic = platform_get_drvdata(pdev); + + if (haptic->suspend_state) { + max77705_haptic_enable(haptic); + haptic->suspend_state = false; + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(max77705_haptic_pm_ops, + max77705_haptic_suspend, + max77705_haptic_resume); + +static const struct of_device_id of_max77705_haptic_dt_match[] = { + { .compatible = "maxim,max77705-haptic", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, of_max77705_haptic_dt_match); + +static struct platform_driver max77705_haptic_driver = { + .driver = { + .name = "max77705-haptic", + .pm = pm_sleep_ptr(&max77705_haptic_pm_ops), + .of_match_table = of_max77705_haptic_dt_match, + }, + .probe = max77705_haptic_probe, + .remove_new = max77705_haptic_remove, +}; +module_platform_driver(max77705_haptic_driver); + +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_AUTHOR("Jaewon Kim "); +MODULE_AUTHOR("Krzysztof Kozlowski "); +MODULE_DESCRIPTION("MAXIM 77705/77705 Haptic driver"); +MODULE_LICENSE("GPL"); From patchwork Tue Jun 18 13:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805320 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEB5C15E5BB; Tue, 18 Jun 2024 14:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719226; cv=none; b=HxiDsXcBqIEC7Q0SsEU5IZFPO0oPIfk8gVLtWjlRypWVwE8yvy5OWhat7uQpENnE6+a8NsQIPe6EpZCDPCZNYSbbhzhwKnVCwjiHTZ+HBrlR6xpLVQFW4r+M/mCHNaHQ042LGYC3heUX/8dO348MbhBVYSj3/kYCh1hY9GDlGug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719226; c=relaxed/simple; bh=BLOwIqGw+wExDrQOQm9Fvk1lqNaWLusTKKjG//P54Vw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BFpmnwh0OEy+erQS6+gPui6lusE26nHjvGx6kceWYGOqHCUVpRcpato9N2SkYkneEkgd6br2/ckk0fXDD6JT7p3l0U1mHw7fg4COQVi48VKOKve/g8nuU0zzsb7ND4wPqvz960m+OTnBsrmMJdbVEcpOMfRE2mv4XFWHpaonE88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kgGZKuRU; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kgGZKuRU" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57cb9a370ddso6246119a12.1; Tue, 18 Jun 2024 07:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719222; x=1719324022; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=qhfnNpNBsnC71c1gGip7xlB/2wIBnZLefF+1ERb3g1U=; b=kgGZKuRUPVFrBnkwOXdnc3rQ/EJUR7xD9bu0ZT6pfAzhdPNYKG/u2s+ZiQWyrQU9PG YqCTev/TFHklivkAzudkfOqFx9NyhG9sk9E78z4MTKprCIb58ZfDbVhnw4vsDRVtzVCx vB/CaYZRheC2ankuaW5VGPoSDWHmFMTIacTURYBjHbJi+69zdP5EkJSe82MKeVc4x5ZD nBd9CQfLt+4LtAVpji1rCa9V6wpqXyiWsc11RN0FZ5xGk8HGn/kdqVfGInqvEyMUQLO7 H3fHtMnOtX+WNhgLd/l+Ix9qO7QtsE7BZOks43tlVRlXEU+iPcpslN8S4dogTb9gAtN6 RFcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719222; x=1719324022; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhfnNpNBsnC71c1gGip7xlB/2wIBnZLefF+1ERb3g1U=; b=k2GbTHiMxhs6vDWMWV9AoO1pLAsFrdaRkRVlcAX5imbFzTS6Gu7rfeKa/xadVst5of iZptKrBzQCVzY16ywuXJET8ZCLaGfTrE8erLos0gKBXVDofc/PLJ4C38ip74TMiqb6ur slilhRvmfpkvD2uotLC3VumGE+PJCINCe9ER7vUAA7CJ1c8LAT63MCrBC5KPTSRUbvj7 w+H0kpZgmLGGkFt5s/nd9AhLlN2jmSpWtUO1pkiApJPCSH/CF3U5Cnz0eHO1lfUdWmD2 xAoCOw+W01Mx+JHfcy98ZFFIMsltaozsjWjdXrorEPedgBnu1ud/hbrT6O+wsOXVlqwY jftw== X-Forwarded-Encrypted: i=1; AJvYcCW0Lib5SdMtYhB9XTbPAtNGA53HTnuWk7UWtrpsy1WJQ6wXituVadkaMQq3GtF0boEsaRZTnT2fJUnmXxLwvt78LGsB1QG/kpMqBGYFcaEQ9HazypG1pMTNpv1lWPeY3gVEAJLOPQEnR3XAKTtWTjK5+SaH7JdkMBvyfiq0D/jnwrUOfp1bWglYnDTSOetGcFdJTnpM9Tju7Q19UZrn9U2c4w3uFx4leUfvFG94lefazA4N7NyHCc9JfhaEUTUWs0SZOsgtEPTl7MZ9GyAibY7evahrS6g+Ow7GP0PQmaWsH7/y9GVSv2wXidnlEDPCJGbOUxG7vyRTGlqXSo8vUyTyFfxr3XDp06uAkGqkVmDu5ooWasZSD6FhcOwg43vO1roSpZgFpSmVfdSmhWwfRM/v3TaqEQ36 X-Gm-Message-State: AOJu0Ywe93JkjXiMAsM2QnccnrXtQ8Qgqw8VY0Btry5afv6mjr8morjq U82YzNDL/f7hr5/3A5W84e1TLCw9RJjTPnXGevuVszSk4RZlefDR X-Google-Smtp-Source: AGHT+IFQTJJ8QXvmtZf52Rf+zFnxjPxqgb7tm/65oOMrxXvpZ0Qcdy5rUNwoYgyi05CXcmCv69WNzA== X-Received: by 2002:a50:ccc5:0:b0:57c:dbf6:931f with SMTP id 4fb4d7f45d1cf-57cdbf694e3mr4303195a12.5.1718719221872; Tue, 18 Jun 2024 07:00:21 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:21 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:49 +0300 Subject: [PATCH v3 15/23] power: supply: max77705: Add fuel gauge driver for Maxim 77705 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-15-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719185; l=23884; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=BLOwIqGw+wExDrQOQm9Fvk1lqNaWLusTKKjG//P54Vw=; b=maw2WZrWl3pVzUdoaXHmGfxI5ztVfjrdMkzqrfqQYRf+fFwaZMnvw7lsTEmQfZhw4lTpZsnIt TK/iewOe2LrAy22IKK7OAVg4nSDqwyizG7HiojHq5SKo0DCRshFJuoA X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add driver for Maxim 77705 fuel gauge (part of max77705 MFD driver) providing power supply class information to userspace. The driver is configured through DTS (battery and system related settings). Signed-off-by: Dzmitry Sankouski --- drivers/power/supply/Kconfig | 7 + drivers/power/supply/Makefile | 1 + drivers/power/supply/max77705_fuelgauge.c | 624 ++++++++++++++++++++++++++++++ include/linux/power/max77705_fuelgauge.h | 107 +++++ 4 files changed, 739 insertions(+) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index 47ca8cc00a80..a3fdfcb5aa64 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -558,6 +558,13 @@ config CHARGER_MAX77705 help Say Y to enable support for the Maxim MAX77705 battery charger. +config FUEL_GAUGE_MAX77705 + tristate "MAX77705 fuel gauge driver" + depends on MFD_MAX77705 + default n + help + Say Y to enable support for MAXIM MAX77705 fuel gauge driver. + config CHARGER_MAX77976 tristate "Maxim MAX77976 battery charger driver" depends on I2C diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile index dbec648c78c9..e1abad8b6b75 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -78,6 +78,7 @@ obj-$(CONFIG_CHARGER_DETECTOR_MAX14656) += max14656_charger_detector.o obj-$(CONFIG_CHARGER_MAX77650) += max77650-charger.o obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o obj-$(CONFIG_CHARGER_MAX77705) += max77705_charger.o +obj-$(CONFIG_FUEL_GAUGE_MAX77705) += max77705_fuelgauge.o obj-$(CONFIG_CHARGER_MAX77976) += max77976_charger.o obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o diff --git a/drivers/power/supply/max77705_fuelgauge.c b/drivers/power/supply/max77705_fuelgauge.c new file mode 100644 index 000000000000..108a829421d7 --- /dev/null +++ b/drivers/power/supply/max77705_fuelgauge.c @@ -0,0 +1,624 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * max77705_fuelgauge.c + * Samsung max77705 Fuel Gauge Driver + * + * Copyright (C) 2015 Samsung Electronics + * Copyright (C) 2024 Dzmitry Sankouski + */ + +#include +#include +#include +#include +#include +#include +#include + +static const char *max77705_fuelgauge_model = "max77705"; +static const char *max77705_fuelgauge_manufacturer = "Maxim Integrated"; +static struct dentry *debugfs_file; + +static enum power_supply_property max77705_fuelgauge_props[] = { + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_PRESENT, + POWER_SUPPLY_PROP_VOLTAGE_NOW, + POWER_SUPPLY_PROP_VOLTAGE_OCV, + POWER_SUPPLY_PROP_VOLTAGE_AVG, + POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CURRENT_AVG, + POWER_SUPPLY_PROP_CHARGE_NOW, + POWER_SUPPLY_PROP_CHARGE_FULL, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_CAPACITY, + POWER_SUPPLY_PROP_TEMP, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, +}; + +static int max77705_fg_read_vcell(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + u16 w_data; + + if (regmap_noinc_read(regmap, VCELL_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read VCELL_REG\n", __func__); + return -1; + } + + w_data = (data[1] << 8) | data[0]; + + return max77705_fg_vs_convert(w_data); +} + +static int max77705_fg_read_vfocv(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + u16 w_data; + + if (regmap_noinc_read(regmap, VFOCV_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read VFOCV_REG\n", __func__); + return -1; + } + + w_data = (data[1] << 8) | data[0]; + + return max77705_fg_vs_convert(w_data); +} + +static int max77705_fg_read_avg_vcell(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + u16 w_data; + + if (regmap_noinc_read(regmap, AVR_VCELL_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read AVR_VCELL_REG\n", __func__); + return -1; + } + + w_data = (data[1] << 8) | data[0]; + return max77705_fg_vs_convert(w_data); +} + +static int max77705_fg_check_battery_present(struct max77705_fuelgauge_data + *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 status_data[2]; + + if (regmap_noinc_read(regmap, STATUS_REG, status_data, sizeof(status_data)) < 0) { + dev_err(fuelgauge->dev, "Failed to read STATUS_REG\n"); + return 0; + } + + return !(status_data[0] & MAX77705_BAT_ABSENT_MASK); +} + +static int max77705_fg_read_temp(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2] = { 0, 0 }; + int temper = 0; + + if (regmap_noinc_read(regmap, TEMPERATURE_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read TEMPERATURE_REG\n", __func__); + return -1; + } + + if (data[1] & BIT(7)) + temper = ((~(data[1])) & 0xFF) + 1; + else + temper = data[1] & 0x7f; + + temper *= 10; + temper += data[0] * 10 / 256; + + return temper; +} + +static int max77705_fg_read_socrep(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int soc; + + if (regmap_noinc_read(regmap, SOCREP_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read SOCREP_REG\n", __func__); + return -1; + } + + soc = data[1]; + + return min(soc, 100); +} + +static int max77705_fg_read_fullcaprep(struct max77705_fuelgauge_data + *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int ret; + + if (regmap_noinc_read(regmap, FULLCAP_REP_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read FULLCAP_REP_REG\n", __func__); + return -1; + } + + ret = (data[1] << 8) + data[0]; + + return ret * 1000; +} + +static int max77705_fg_read_repcap(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int ret; + + if (regmap_noinc_read(regmap, REMCAP_REP_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read REMCAP_REP_REG\n", __func__); + return -1; + } + + ret = (data[1] << 8) + data[0]; + + return ret * 1000; +} + +static int max77705_fg_read_charge_design(struct max77705_fuelgauge_data + *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int reg; + + if (regmap_noinc_read(regmap, DESIGNCAP_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read DESIGNCAP_REG\n", __func__); + return -1; + } + + reg = (data[1] << 8) | (data[0]); + + return reg * 1000; +} + +static int max77705_fg_set_charge_design(struct regmap *regmap, int value) +{ + u8 data[2]; + int value_mah; + + value_mah = value / 1000; + data[0] = value_mah & 0xFF; + data[1] = (value_mah >> 8) & 0xFF; + + if (regmap_noinc_write(regmap, DESIGNCAP_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to write DESIGNCAP_REG\n", __func__); + return -1; + } + + return 0; +} + +static int max77705_fg_read_current(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 reg_data[2]; + s16 reg_value; + s32 i_current; + + if (regmap_noinc_read(regmap, CURRENT_REG, reg_data, sizeof(reg_data)) < 0) { + pr_err("%s: Failed to read CURRENT\n", __func__); + return -1; + } + + reg_value = ((reg_data[1] << 8) | reg_data[0]); + i_current = max77705_fg_cs_convert(reg_value, fuelgauge->rsense_conductance); + + return i_current; +} + +static int max77705_fg_read_avg_current(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 reg_data[2]; + u32 reg_value; + s32 avg_current; + + if (regmap_noinc_read(regmap, AVG_CURRENT_REG, reg_data, sizeof(reg_data)) < 0) { + pr_err("%s: Failed to read AVG_CURRENT_REG\n", __func__); + return -1; + } + + reg_value = ((reg_data[1] << 8) | reg_data[0]); + avg_current = max77705_fg_cs_convert(reg_value, fuelgauge->rsense_conductance); + + return avg_current; +} + +static int max77705_fg_read_tte(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int reg; + + if (regmap_noinc_read(regmap, TIME_TO_EMPTY_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read TIME_TO_EMPTY_REG\n", __func__); + return -1; + } + + reg = (data[1] << 8) | (data[0]); + + return reg; +} + +static int max77705_fg_read_ttf(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int reg; + + if (regmap_noinc_read(regmap, TIME_TO_FULL_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read TIME_TO_FULL_REG\n", __func__); + return -1; + } + + reg = (data[1] << 8) | (data[0]); + + return reg; +} + +static int max77705_fg_read_cycle(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2]; + int ret; + + if (regmap_noinc_read(regmap, CYCLES_REG, data, sizeof(data)) < 0) { + pr_err("%s: Failed to read CYCLES_REG\n", __func__); + return -1; + } + + ret = (data[1] << 8) + data[0]; + + return ret; +} + +static int max77705_battery_get_status(struct max77705_fuelgauge_data *fuelgauge) +{ + int current_now; + int am_i_supplied; + + am_i_supplied = power_supply_am_i_supplied(fuelgauge->psy_fg); + if (am_i_supplied) { + if (am_i_supplied == -ENODEV) + dev_err(fuelgauge->dev, + "power supply not found, fall back to current-based status checking\n"); + else + return POWER_SUPPLY_STATUS_CHARGING; + } + if (max77705_fg_read_socrep(fuelgauge) < 100) { + current_now = max77705_fg_read_current(fuelgauge); + if (current_now > 0) + return POWER_SUPPLY_STATUS_CHARGING; + else if (current_now < 0) + return POWER_SUPPLY_STATUS_DISCHARGING; + else + return POWER_SUPPLY_STATUS_NOT_CHARGING; + } else { + return POWER_SUPPLY_STATUS_FULL; + } + return POWER_SUPPLY_STATUS_DISCHARGING; +} + +static bool max77705_fg_init(struct max77705_fuelgauge_data *fuelgauge) +{ + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + u8 data[2] = { 0, 0 }; + u32 volt_threshold = 0; + u32 temp_threshold = 0; + + if (fuelgauge->auto_discharge_en) { + /* Auto discharge EN & Alert Enable */ + regmap_noinc_read(regmap, CONFIG2_REG, data, sizeof(data)); + data[1] |= MAX77705_AUTO_DISCHARGE_EN_MASK >> 8; + regmap_noinc_write(regmap, CONFIG2_REG, data, sizeof(data)); + + /* Set Auto Discharge temperature & Voltage threshold */ + volt_threshold = + fuelgauge->discharge_volt_threshold < 3900 ? 0x0 : + fuelgauge->discharge_volt_threshold > 4540 ? 0x20 : + (fuelgauge->discharge_volt_threshold - 3900) / 20; + + temp_threshold = + fuelgauge->discharge_temp_threshold < 470 ? 0x0 : + fuelgauge->discharge_temp_threshold > 630 ? 0x20 : + (fuelgauge->discharge_temp_threshold - 470) / 5; + + regmap_noinc_read(regmap, DISCHARGE_THRESHOLD_REG, data, sizeof(data)); + data[1] &= ~MAX77705_AUTO_DISCHARGE_VALUE_MASK; + data[1] |= volt_threshold << MAX77705_AUTO_DISCHARGE_VALUE_SHIFT; + + data[0] &= ~MAX77705_AUTO_DISCHARGE_VALUE_MASK; + data[0] |= temp_threshold << MAX77705_AUTO_DISCHARGE_VALUE_SHIFT; + + regmap_noinc_write(regmap, DISCHARGE_THRESHOLD_REG, data, sizeof(data)); + + pr_info("%s: DISCHARGE_THRESHOLD Value : 0x%x\n", + __func__, (data[1] << 8) | data[0]); + } + + return true; +} + +static int max77705_fg_get_property(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val) +{ + struct max77705_fuelgauge_data *fuelgauge = + power_supply_get_drvdata(psy); + + switch (psp) { + case POWER_SUPPLY_PROP_STATUS: + val->intval = max77705_battery_get_status(fuelgauge); + break; + case POWER_SUPPLY_PROP_PRESENT: + val->intval = max77705_fg_check_battery_present(fuelgauge); + break; + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + val->intval = max77705_fg_read_vcell(fuelgauge); + break; + case POWER_SUPPLY_PROP_VOLTAGE_OCV: + val->intval = max77705_fg_read_vfocv(fuelgauge); + break; + case POWER_SUPPLY_PROP_VOLTAGE_AVG: + val->intval = max77705_fg_read_avg_vcell(fuelgauge); + break; + case POWER_SUPPLY_PROP_CURRENT_NOW: + val->intval = max77705_fg_read_current(fuelgauge); + break; + case POWER_SUPPLY_PROP_CURRENT_AVG: + val->intval = max77705_fg_read_avg_current(fuelgauge); + break; + case POWER_SUPPLY_PROP_CHARGE_NOW: + val->intval = max77705_fg_read_repcap(fuelgauge); + break; + case POWER_SUPPLY_PROP_CHARGE_FULL: + val->intval = max77705_fg_read_fullcaprep(fuelgauge); + break; + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + val->intval = max77705_fg_read_charge_design(fuelgauge); + break; + case POWER_SUPPLY_PROP_CAPACITY: + val->intval = max77705_fg_read_socrep(fuelgauge); + break; + case POWER_SUPPLY_PROP_TEMP: + val->intval = max77705_fg_read_temp(fuelgauge); + break; + case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW: + val->intval = max77705_fg_read_tte(fuelgauge); + break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + val->intval = max77705_fg_read_ttf(fuelgauge); + break; + case POWER_SUPPLY_PROP_CYCLE_COUNT: + val->intval = max77705_fg_read_cycle(fuelgauge); + break; + case POWER_SUPPLY_PROP_MODEL_NAME: + val->strval = max77705_fuelgauge_model; + break; + case POWER_SUPPLY_PROP_MANUFACTURER: + val->strval = max77705_fuelgauge_manufacturer; + break; + default: + return -EINVAL; + } + return 0; +} + +static int max77705_fuelgauge_debugfs_show(struct seq_file *s, void *data) +{ + struct max77705_fuelgauge_data *fuelgauge = s->private; + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + int i; + u16 reg_data; + int regs[] = { 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x08, 0x09, 0x11, 0x13, 0x0A, + 0x0B, 0x0D, 0x0E, 0x0F, 0x10, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20, + 0x1D, 0x1E, 0x1F, 0x23, 0x28, 0x29, 0x2B, 0x32, 0x35, 0x38, 0x3A, + 0x3D, 0x40, 0x42, 0x43, 0x45, 0x46, 0x4B, 0x4D, 0xB1, 0xB2, 0xB3, + 0xBB, 0xD0, 0xEE, 0xFB, 0xFF, }; + + seq_puts(s, "MAX77705 FUELGAUGE IC :\n"); + seq_puts(s, "===================\n"); + for (i = 0; i < ARRAY_SIZE(regs); i++) { + regmap_noinc_read(regmap, regs[i], ®_data, 2); + seq_printf(s, "0x%02x:\t0x%02x\n", regs[i], reg_data); + } + seq_puts(s, "\n"); + return 0; +} + +static int max77705_fuelgauge_debugfs_open(struct inode *inode, + struct file *file) +{ + return single_open(file, max77705_fuelgauge_debugfs_show, inode->i_private); +} + +static const struct file_operations max77705_fuelgauge_debugfs_fops = { + .open = max77705_fuelgauge_debugfs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static void max77705_battery_settings(struct max77705_fuelgauge_data *fuelgauge) +{ + struct power_supply_battery_info *info; + struct regmap *regmap = fuelgauge->max77705->regmap_fg; + + if (power_supply_get_battery_info(fuelgauge->psy_fg, &info) < 0) + return; + + fuelgauge->bat_info = info; + + if (!regmap) { + dev_warn(fuelgauge->dev, "data memory update not supported for chip\n"); + return; + } + + if (info->energy_full_design_uwh != info->charge_full_design_uah) { + if (info->charge_full_design_uah == -EINVAL) + dev_warn(fuelgauge->dev, "missing battery:charge-full-design-microamp-hours\n"); + max77705_fg_set_charge_design(regmap, info->charge_full_design_uah); + } +} + +static int max77705_fuelgauge_parse_dt(struct max77705_fuelgauge_data + *fuelgauge) +{ + struct device *dev = fuelgauge->dev; + struct device_node *np = dev->of_node; + unsigned int rsense; + + if (!np) { + dev_err(dev, "no fuelgauge OF node\n"); + return -EINVAL; + } + + int ret; + + if (np == NULL) { + pr_err("%s np NULL\n", __func__); + return -EINVAL; + } + + ret = of_property_read_u32(np, "rsense", + &rsense); + if (ret < 0) { + pr_err("%s error reading rsense %d\n", + __func__, ret); + fuelgauge->rsense_conductance = 100; + } else + fuelgauge->rsense_conductance = 1000 / rsense; /* rsense in Ohm^-1 */ + + fuelgauge->auto_discharge_en = of_property_read_bool(np, + "auto_discharge_en"); + if (fuelgauge->auto_discharge_en) { + ret = of_property_read_u32(np, + "discharge_temp_threshold", + &fuelgauge->discharge_temp_threshold); + if (ret < 0) { + dev_err(dev, "error reading rsense_conductance %d\n", ret); + fuelgauge->discharge_temp_threshold = 600; + } + + ret = of_property_read_u32(np, + "discharge_volt_threshold", + &fuelgauge->discharge_volt_threshold); + if (ret < 0) + fuelgauge->discharge_volt_threshold = 4200; + } + + return 0; +} + +static const struct power_supply_desc max77705_fuelgauge_power_supply_desc = { + .name = "max77705-fuelgauge", + .type = POWER_SUPPLY_TYPE_BATTERY, + .properties = max77705_fuelgauge_props, + .num_properties = ARRAY_SIZE(max77705_fuelgauge_props), + .get_property = max77705_fg_get_property, +}; + +static int max77705_fuelgauge_probe(struct platform_device *pdev) +{ + struct max77705_dev *max77705 = dev_get_drvdata(pdev->dev.parent); + struct max77705_platform_data *pdata = dev_get_platdata(max77705->dev); + struct max77705_fuelgauge_data *fuelgauge; + struct power_supply_config fuelgauge_cfg = { }; + int ret = 0; + + fuelgauge = kzalloc(sizeof(*fuelgauge), GFP_KERNEL); + if (!fuelgauge) + return -ENOMEM; + + mutex_init(&fuelgauge->fg_lock); + + fuelgauge->dev = &pdev->dev; + fuelgauge->max77705 = max77705; + fuelgauge->max77705_pdata = pdata; + + ret = max77705_fuelgauge_parse_dt(fuelgauge); + if (ret < 0) + pr_err("%s not found charger dt! ret[%d]\n", __func__, ret); + + platform_set_drvdata(pdev, fuelgauge); + + + debugfs_file = debugfs_create_file("max77705-fuelgauge-regs", + 0664, NULL, (void *)fuelgauge, + &max77705_fuelgauge_debugfs_fops); + if (!debugfs_file) + dev_err(fuelgauge->dev, "Failed to create debugfs file\n"); + + fuelgauge_cfg.drv_data = fuelgauge; + fuelgauge_cfg.of_node = fuelgauge->dev->of_node; + + fuelgauge->psy_fg = + devm_power_supply_register(&pdev->dev, + &max77705_fuelgauge_power_supply_desc, + &fuelgauge_cfg); + + if (IS_ERR(fuelgauge->psy_fg)) { + pr_err("%s: Failed to Register psy_fg\n", __func__); + goto err_data_free; + } + + fuelgauge->fg_irq = max77705->irq_base + MAX77705_FG_IRQ_ALERT; + pr_info("[%s]IRQ_BASE(%d) FG_IRQ(%d)\n", + __func__, max77705->irq_base, fuelgauge->fg_irq); + + if (!max77705_fg_init(fuelgauge)) { + pr_err("%s: Failed to Initialize Fuelgauge\n", __func__); + goto err_supply_unreg; + } + + max77705_battery_settings(fuelgauge); + + return 0; + +err_supply_unreg: + power_supply_unregister(fuelgauge->psy_fg); + kfree(fuelgauge->bat_info); +err_data_free: + mutex_destroy(&fuelgauge->fg_lock); + + return ret; +} + +static void max77705_fuelgauge_remove(struct platform_device *pdev) +{ + if (debugfs_file) + debugfs_remove(debugfs_file); +} +static const struct platform_device_id max77705_fuelgauge_id[] = { + { "max77705-fuelgauge", 0, }, + { } +}; +MODULE_DEVICE_TABLE(platform, max77705_fuelgauge_id); + +static struct platform_driver max77705_fuelgauge_driver = { + .driver = { + .name = "max77705-fuelgauge", + }, + .probe = max77705_fuelgauge_probe, + .remove_new = max77705_fuelgauge_remove, + .id_table = max77705_fuelgauge_id, +}; +module_platform_driver(max77705_fuelgauge_driver); + +MODULE_DESCRIPTION("Samsung max77705 Fuel Gauge Driver"); +MODULE_AUTHOR("Samsung Electronics"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/power/max77705_fuelgauge.h b/include/linux/power/max77705_fuelgauge.h new file mode 100644 index 000000000000..718cd47bc7b6 --- /dev/null +++ b/include/linux/power/max77705_fuelgauge.h @@ -0,0 +1,107 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * max77705_fuelgauge.h + * Samsung max77705 Fuel Gauge Header + * + * Copyright (C) 2015 Samsung Electronics, Inc. + * + * This software is 77854 under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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 __MAX77705_FUELGAUGE_H +#define __MAX77705_FUELGAUGE_H __FILE__ + +#include +#include +#include +#include + +#define ALERT_EN 0x04 +#define CAPACITY_SCALE_DEFAULT_CURRENT 1000 +#define CAPACITY_SCALE_HV_CURRENT 600 +/* + * Current and capacity values are displayed as a voltage + * and must be divided by the sense resistor to determine Amps or Amp-hours. + * This should be applied to all current, charge, energy registers, + * except ModelGauge m5 Algorithm related ones. + */ +/* current sense resolution */ +#define MAX77705_FG_CS_ADC_RESOLUTION 15625 /* 1.5625 microvolts */ +/* voltage sense resolution */ +#define MAX77705_FG_VS_ADC_RESOLUTION 78125 /* 78.125 microvolts */ +/* CONFIG register */ +#define MAX77705_SOC_ALERT_EN_MASK BIT(2) +/* When set to 1, external temperature measurements should be written from the host */ +#define MAX77705_TEX_MASK BIT(8) +/* Enable Thermistor */ +#define MAX77705_ETHRM_MASK BIT(5) +/* CONFIG2 register */ +#define MAX77705_AUTO_DISCHARGE_EN_MASK BIT(9) +/* DISCHARGE register*/ +#define MAX77705_AUTO_DISCHARGE_VALUE_SHIFT 3 +#define MAX77705_AUTO_DISCHARGE_VALUE_MASK 0xF8 + +#define MAX77705_FG_CS_MASK BIT(15) +/* MISCCFG register */ +#define MAX77705_AUTO_DISCHARGE_VALUE_MASK 0xF8 + +/* adc resolution for voltage sensing is 78.125 microvolts */ +inline u64 max77705_fg_vs_convert(u16 reg_val) +{ + u64 result = (u64)reg_val * MAX77705_FG_VS_ADC_RESOLUTION; + + return result / 1000; +} + +/* adc resolution for current sensing is 1.5625 microvolts */ +inline s32 max77705_fg_cs_convert(s16 reg_val, u32 rsense_conductance) +{ + s64 result = (s64)reg_val * rsense_conductance * MAX77705_FG_CS_ADC_RESOLUTION; + + return result / 10000; +} + +struct max77705_fuelgauge_data { + struct device *dev; + struct i2c_client *i2c; + struct i2c_client *pmic; + struct mutex fuelgauge_mutex; + struct max77705_dev *max77705; + struct max77705_platform_data *max77705_pdata; + struct power_supply *psy_fg; + struct delayed_work isr_work; + + int cable_type; + bool is_charging; + + struct power_supply_battery_info *bat_info; + + struct mutex fg_lock; + + /* register programming */ + int reg_addr; + u8 reg_data[2]; + + unsigned int pre_soc; + int fg_irq; + + int temperature; + int low_temp_limit; + + bool auto_discharge_en; + u32 discharge_temp_threshold; + u32 discharge_volt_threshold; + + u32 rsense_conductance; + u32 fuel_alert_soc; +}; + +#endif /* __MAX77705_FUELGAUGE_H */ From patchwork Tue Jun 18 13:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805319 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 634C119F481; Tue, 18 Jun 2024 14:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719230; cv=none; b=LcIkCNRNd76CbUF70hzUM8odfWr7t11UUHg0fk2oEGTD1ZsMDxO8FBM1WaxoalFpo6PhKKEawNMWg2kPwR4zegemjm1CqXXhROSnYNarl/lhibDASY8LmI+E6lzMqnEAVUSvpjyjPCcIAeQVLWsKt0Z1JLZdzrMKlcSgNX9RKyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719230; c=relaxed/simple; bh=IHZAr5+Cdn0wmqhOZ2PeM9l2Gdz/tWq1OFfADxf5XIQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gmrlZ8lp74xDEcU2MSdycnbtdMjIVtoyIAVk9IWsMxzvrbI8Lx2b9WfBCtlLkB7MDTwyxs7kCLQ4Ln2QwCUDQNWWzH/gMTf++PLBXTWHPwB4eNLnT0eqc1BNFvHpu5663BFdyAaOiPJ7AMESifYSDexj7jhfRfMueAvTBH05cgo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lRmTYiqe; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lRmTYiqe" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-57d046f4afdso268519a12.1; Tue, 18 Jun 2024 07:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719227; x=1719324027; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lVpSUbQ0RxUxTD6Qqs+KFz8X9qCBPybUa3iBtTp8xZM=; b=lRmTYiqet/n1S42Ij86i6/mKITc/Imt1qa53nFDawxVKRJ816hLtRJklA2XIpSXIfb DC49NQekC1RROEHKXg68LwOS1b1+tqrwQgGjH4Vrpy5Ano2F9vCXF8dJiBIez7RSzUBv Y5SgR7pa/gB3eLDRm1bPItyFIlfDR7rgzWaaqaQtIzztHRhFZ/3t9f2fvb6HQ34qjygU 4hZ7ADKmm/4+nYWKTkHcMjr2MHybBem5EEZqau3gxJq2ocmtBfmQXicl3udNmUGpiTpv WFhtfYkTwMo9L9snTzCTRpfjGb/lXaT7kpqWwIQzeVqei/eKPWwjPszGSEMAd91RGa2u B6Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719227; x=1719324027; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lVpSUbQ0RxUxTD6Qqs+KFz8X9qCBPybUa3iBtTp8xZM=; b=F8GD1Bh3NCRgE837DsrVjgqCFFA+ZxCm9NgePdBy9jhCPKVXyVX8P1ByKxdHR3qlJe bb6f2zzjCWkdmIDgm3S+u5fgxm7HPrRF0hRi1PK89z2HM7roxH2TRInxvokBLDVoXFhU yuGVu7Vu+3XA/K+RTwRZRUsfiPIIDqFEKjUiYrRZxbBYp4BhlZIPY/F7p5JHOMu7fKy4 XWdRq1FHPUUzMpoajn7eHxh4VtNe1Nh4eY7IJp+JblXtqqaF+SKjhw53xEVX8HIcVR4S oNTyTl0YhtBfqYNd+PYow0k7LFnwrM6cCH9VqxGviYEh8q3NnAI8kuBZG0ZZDIj+dugY 2RFQ== X-Forwarded-Encrypted: i=1; AJvYcCXuqk9s42snKqAdQttXyUbGb0PYEL3PmCfhbdrU1xRo4P+BTo/HFj/C0DSRdNeigtoNnwGossdZlrpCLgOaHQw/X7TTSq9DNveNKxUsbWBHQU3jLhONeDExDDWHwq8b8GbnqUcojHGszH0WpySywWhxzTSWwjqpGQ70ZZqmDBl2vxKvZtu6FaYpSnuF6K1DLp11M6NG8yUUK1NGnJFh8cn2mtQl/c/MF/c200PMv151iBoxBO6Ery4ZYYjnih7DXHiWNvBMu9QOADOXWO02GXYBR1zc7Rn7YqQiFkSGdJOoXFM/ybYPMTCjacluKeL5PwL3Uan1d0VsrDCEsL60KjoWY0SVanY57um9ZFtvqeo2G62d3Dq05hC4JBGq8kBZY7xuRnC1JOdB6NXcGTZq7FSa7YpVFg5b X-Gm-Message-State: AOJu0Yw1RjUnw6IeSj8Bc/d/HdWjtRC33Deyco7FsZbq4SyqCeovVlar h0LL5slC21BAOYM+p+hEr1zyVxoSGddGXUyHjWFi8pR322NV1NAf X-Google-Smtp-Source: AGHT+IHe/0ra3yC6deGQmpMua4UTqdcMRRszmsFv8+QoEjoDXgFjZqQesDDjmgynaNQbxBP6akhjMw== X-Received: by 2002:aa7:ce04:0:b0:57d:3cf:899d with SMTP id 4fb4d7f45d1cf-57d03cf8aa2mr974692a12.22.1718719226445; Tue, 18 Jun 2024 07:00:26 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:26 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:51 +0300 Subject: [PATCH v3 17/23] mfd: add s2dos series core driver Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-17-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719185; l=10509; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=IHZAr5+Cdn0wmqhOZ2PeM9l2Gdz/tWq1OFfADxf5XIQ=; b=l66fMD8sHB8UJYTpLpJ1ay3lJvzfpqGlDq6nPosqrMEDYoFHMPD/dy7mDaSAk2An0pOO6QxUi qEyrqTzd98iCKNsZDfsTPkuE8JTVRSRulb9nsxxFrfA4H6vj652yV10 X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= S2DOS05 is a panel/touchscreen PMIC, often found in Samsung phones. We define 2 sub-devices for which drivers will be added in subsequent patches. Signed-off-by: Dzmitry Sankouski --- MAINTAINERS | 1 + drivers/mfd/Kconfig | 13 +++ drivers/mfd/Makefile | 2 +- drivers/mfd/s2dos-core.c | 141 +++++++++++++++++++++++++++++++++ include/linux/mfd/samsung/s2dos-core.h | 21 +++++ include/linux/mfd/samsung/s2dos05.h | 115 +++++++++++++++++++++++++++ 6 files changed, 292 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index f3c245d432d9..b53462684a30 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19908,6 +19908,7 @@ F: Documentation/devicetree/bindings/regulator/samsung,s2dos*.yaml F: Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml F: Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml F: drivers/clk/clk-s2mps11.c +F: drivers/mfd/s2dos*.c F: drivers/mfd/sec*.c F: drivers/regulator/s2m*.c F: drivers/regulator/s5m*.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index c4eb8ff2dcad..517d8778d7a8 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -1278,6 +1278,19 @@ config MFD_RN5T618 additional drivers must be enabled in order to use the functionality of the device. +config MFD_S2DOS_CORE + tristate "Samsung Electronics PMIC Series Support" + depends on I2C=y + depends on OF + select MFD_CORE + select REGMAP_I2C + help + Support for the Samsung Electronics PMIC devices + usually used to power displays. + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the functionality + of the device. + config MFD_SEC_CORE tristate "Samsung Electronics PMIC Series Support" depends on I2C=y diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index bf65cc36d59c..37c51aab0205 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -228,7 +228,7 @@ obj-$(CONFIG_MFD_RK8XX_I2C) += rk8xx-i2c.o obj-$(CONFIG_MFD_RK8XX_SPI) += rk8xx-spi.o obj-$(CONFIG_MFD_RN5T618) += rn5t618.o obj-$(CONFIG_MFD_SEC_CORE) += sec-core.o sec-irq.o -obj-$(CONFIG_MFD_S2DOS05) += s2dos05.o +obj-$(CONFIG_MFD_S2DOS_CORE) += s2dos-core.o obj-$(CONFIG_MFD_SYSCON) += syscon.o obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o obj-$(CONFIG_MFD_VEXPRESS_SYSREG) += vexpress-sysreg.o diff --git a/drivers/mfd/s2dos-core.c b/drivers/mfd/s2dos-core.c new file mode 100644 index 000000000000..a04363b15a2a --- /dev/null +++ b/drivers/mfd/s2dos-core.c @@ -0,0 +1,141 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * s2dos05.c - mfd core driver for the s2dos05 chip + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Copyright (C) 2024 Dzmitry Sankouski + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct dentry *debugfs_file; + +static int s2dos05_debugfs_show(struct seq_file *s, void *data) +{ + struct s2dos_core *s2dos05 = s->private; + struct regmap *regmap = s2dos05->regmap; + unsigned int i, reg, reg_data, pmic_id; + int regs[] = { + S2DOS05_REG_DEV_ID, + S2DOS05_REG_TOPSYS_STAT, + S2DOS05_REG_STAT, + S2DOS05_REG_EN, + S2DOS05_REG_LDO1_CFG, + S2DOS05_REG_LDO2_CFG, + S2DOS05_REG_LDO3_CFG, + S2DOS05_REG_LDO4_CFG, + S2DOS05_REG_BUCK_CFG, + S2DOS05_REG_BUCK_VOUT, + S2DOS05_REG_IRQ_MASK, + S2DOS05_REG_SSD_TSD, + S2DOS05_REG_OCL, + S2DOS05_REG_IRQ + }; + regmap_read(regmap, S2DOS05_REG_DEV_ID, &pmic_id); + seq_printf(s, "S2DOS05, id: %d\n", pmic_id); + seq_puts(s, "===================\n"); + for (i = 0; i < ARRAY_SIZE(regs); i++) { + reg = regs[i]; + regmap_read(regmap, reg, ®_data); + seq_printf(s, "0x%02x:\t0x%02x\n", reg, reg_data); + } + + seq_puts(s, "\n"); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(s2dos05_debugfs); + +static const struct regmap_config s2dos05_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = S2DOS05_REG_IRQ, +}; + +static struct mfd_cell s2dos05_devs[] = { + { .name = "s2dos05-fg" }, + { + .name = "s2dos05-regulator", + .of_compatible = "samsung,s2dos05-regulator", + }, +}; + + +static int s2dos05_i2c_probe(struct i2c_client *i2c) +{ + struct s2dos_core *s2dos05; + struct regmap *regmap; + struct device *dev = &i2c->dev; + + unsigned int reg_data; + int ret = 0; + + s2dos05 = kzalloc(sizeof(struct s2dos_core), GFP_KERNEL); + if (!s2dos05) + return -ENOMEM; + + regmap = devm_regmap_init_i2c(i2c, &s2dos05_regmap_config); + if (IS_ERR(regmap)) { + dev_err(dev, "Unable to initialise I2C Regmap\n"); + return PTR_ERR(regmap); + } + s2dos05->regmap = regmap; + + if (regmap_read(regmap, S2DOS05_REG_DEV_ID, ®_data) < 0) { + dev_err(dev, + "device not found on this channel (this is not an error)\n"); + ret = -ENODEV; + } else { + dev_info(dev, "%s device found with id: .0x%x\n", + __func__, reg_data); + } + + i2c_set_clientdata(i2c, s2dos05); + + debugfs_file = debugfs_create_file("s2dos05-regs", + 0664, NULL, (void *)s2dos05, + &s2dos05_debugfs_fops); + if (!debugfs_file) + dev_err(dev, "Failed to create debugfs file\n"); + + return mfd_add_devices(dev, -1, s2dos05_devs, + ARRAY_SIZE(s2dos05_devs), NULL, 0, NULL); +} + +static const struct of_device_id s2dos05_i2c_dt_ids[] = { + { .compatible = "samsung,s2dos05-pmic" }, + { }, +}; +MODULE_DEVICE_TABLE(of, s2dos05_i2c_dt_ids); + +static struct i2c_driver s2dos05_i2c_driver = { + .driver = { + .name = "s2dos-core", + .owner = THIS_MODULE, + .of_match_table = s2dos05_i2c_dt_ids, + }, + .probe = s2dos05_i2c_probe, +}; + +module_i2c_driver(s2dos05_i2c_driver); + +MODULE_DESCRIPTION("s2dos core driver"); +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/samsung/s2dos-core.h b/include/linux/mfd/samsung/s2dos-core.h new file mode 100644 index 000000000000..7e84b387063c --- /dev/null +++ b/include/linux/mfd/samsung/s2dos-core.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * s2dos-core.h + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * http://www.samsung.com + * Copyright (C) 2024 Dzmitry Sankouski + * + */ + +#ifndef __LINUX_MFD_S2DOS_CORE_H +#define __LINUX_MFD_S2DOS_CORE_H +#include +#include + +struct s2dos_core { + struct device *dev; + struct regmap *regmap; +}; + +#endif /* __LINUX_MFD_S2DOS_CORE_H */ diff --git a/include/linux/mfd/samsung/s2dos05.h b/include/linux/mfd/samsung/s2dos05.h new file mode 100644 index 000000000000..0317dbe56f10 --- /dev/null +++ b/include/linux/mfd/samsung/s2dos05.h @@ -0,0 +1,115 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * s2dos05.h + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * http://www.samsung.com + * + */ + +#ifndef __LINUX_MFD_S2DOS05_H +#define __LINUX_MFD_S2DOS05_H + +/* S2DOS05 registers */ +/* Slave Addr : 0xC0 */ +enum s2dos05_reg { + S2DOS05_REG_DEV_ID, + S2DOS05_REG_TOPSYS_STAT, + S2DOS05_REG_STAT, + S2DOS05_REG_EN, + S2DOS05_REG_LDO1_CFG, + S2DOS05_REG_LDO2_CFG, + S2DOS05_REG_LDO3_CFG, + S2DOS05_REG_LDO4_CFG, + S2DOS05_REG_BUCK_CFG, + S2DOS05_REG_BUCK_VOUT, + S2DOS05_REG_IRQ_MASK = 0x0D, + S2DOS05_REG_SSD_TSD = 0x0E, + S2DOS05_REG_OCL = 0x10, + S2DOS05_REG_IRQ = 0x11 +}; + +/* S2DOS05 regulator ids */ +enum s2dos05_regulators { + S2DOS05_LDO1, + S2DOS05_LDO2, + S2DOS05_LDO3, + S2DOS05_LDO4, + S2DOS05_BUCK1, + S2DOS05_REG_MAX, +}; + +#define S2DOS05_IRQ_PWRMT_MASK BIT(5) +#define S2DOS05_IRQ_TSD_MASK BIT(4) +#define S2DOS05_IRQ_SSD_MASK BIT(3) +#define S2DOS05_IRQ_SCP_MASK BIT(2) +#define S2DOS05_IRQ_UVLO_MASK BIT(1) +#define S2DOS05_IRQ_OCD_MASK BIT(0) + +#define S2DOS05_BUCK_MIN1 506250 +#define S2DOS05_LDO_MIN1 1500000 +#define S2DOS05_LDO_MIN2 2700000 +#define S2DOS05_BUCK_STEP1 6250 +#define S2DOS05_LDO_STEP1 25000 +#define S2DOS05_LDO_VSEL_MASK 0x7F +#define S2DOS05_LDO_FD_MASK BIT(7) +#define S2DOS05_BUCK_VSEL_MASK 0xFF +#define S2DOS05_BUCK_FD_MASK BIT(3) + +#define S2DOS05_ENABLE_MASK_L1 BIT(0) +#define S2DOS05_ENABLE_MASK_L2 BIT(1) +#define S2DOS05_ENABLE_MASK_L3 BIT(2) +#define S2DOS05_ENABLE_MASK_L4 BIT(3) +#define S2DOS05_ENABLE_MASK_B1 BIT(4) + +#define S2DOS05_RAMP_DELAY 12000 + +#define S2DOS05_ENABLE_TIME_LDO 50 +#define S2DOS05_ENABLE_TIME_BUCK 350 + +#define S2DOS05_ENABLE_SHIFT 0x06 +#define S2DOS05_LDO_N_VOLTAGES (S2DOS05_LDO_VSEL_MASK + 1) +#define S2DOS05_BUCK_N_VOLTAGES (S2DOS05_BUCK_VSEL_MASK + 1) + +#define S2DOS05_PMIC_EN_SHIFT 6 +#define S2DOS05_REGULATOR_MAX (S2DOS05_REG_MAX) + +/* ----------power meter ----------*/ +#define S2DOS05_REG_PWRMT_CTRL1 0x0A +#define S2DOS05_REG_PWRMT_CTRL2 0x0B +#define S2DOS05_REG_PWRMT_DATA 0x0C +#define S2DOS05_REG_IRQ_MASK 0x0D + +#define CHANNEL_ELVDD 0 +#define CHANNEL_ELVSS 1 +#define CHANNEL_AVDD 2 +#define CHANNEL_BUCK 3 +#define CHANNEL_L1 4 +#define CHANNEL_L2 5 +#define CHANNEL_L3 6 +#define CHANNEL_L4 7 + +#define POWER_ELVDD 24500 +#define POWER_ELVSS 24500 +#define POWER_AVDD 3060 +#define POWER_BUCK 1525 +#define POWER_L1 5000 +#define POWER_L2 5000 +#define POWER_L3 5000 +#define POWER_L4 5000 + +/* S2DOS05_REG_OCL */ +#define ADC_VALID_MASK BIT(7) +/* S2DOS05_REG_PWRMT_CTRL1 */ +#define ADC_ASYNCRD_MASK BIT(7) +#define PWRMT_EN_CHK BIT(6) +#define SMPNUM_MASK 0x0F +/* S2DOS05_REG_PWRMT_CTRL2 */ +#define ADC_EN_MASK BIT(7) +#define ADC_PTR_MASK 0x0F +#define POWER_MODE BIT(4) +#define RAWCURRENT_MODE BIT(5) + +#define S2DOS05_MAX_ADC_CHANNEL 8 + +#endif /* __LINUX_MFD_S2DOS05_H */ From patchwork Tue Jun 18 13:59:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805318 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0677D1A00CF; Tue, 18 Jun 2024 14:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719235; cv=none; b=uISn4HKfM5+6osFDcB0EOY1Tlshrr6b0OKmbRjorFqsIYYxx7ibhhVQ3z9Z0kLl2u+BzS1wH0jDkG9ntXPk/LEUCmF+tjaR5SJFxYyY6LNf9Pla1eFSOX1LnzDxdtn+n52SV7dQiaqze6wSz2ZvAd3bwB2RRNxpyGkgwJoUBwjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719235; c=relaxed/simple; bh=M+uc6GTvoNAckqEvB4YdUBo7gTDSwvEY9HdmtBtM0OA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EUEMjG3C5POw2oTDoARBqnYZfJshcF5DK+HAMqyFDnOzmrTQyDgKpdWNC+FVRw2S4OQ27kh6EY03Swj52uPoaBThKqPJj7rMEIxlT7ek8+Sy0K6QH7SPclw7rDB/Y2rJ6O1+WqVlNqMYs2L/NPAka5WC2SapFhVDBeV2FV8v1YE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YFU/fJNi; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YFU/fJNi" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57cc7e85b4bso2284452a12.0; Tue, 18 Jun 2024 07:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719231; x=1719324031; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Q4ELQwjzHA4yApdsWewX3oXEq3EZwSJvDLoYd1jNQ34=; b=YFU/fJNiLdWH8K5pTEa8pKMdTc8UeFGXXaecMbItRVi4/091B7mJ6hPwY2Fc8U2av8 qFJYnuCGEUpcbnM472oqomhNm/cRU6LyfLPwTDLLv5FRPVal9KbDnkCCpvJSd1K5U9mE gYcnC098z3Gkze3wC+FPMRVyT3TEs60A2hO6dyHFnK42ocMoGaYFsBDvZqW/LhNwTiXK hB+EFpw/oLtNzkqME+7uarAjt1vWOpDGXAEmarzxH/O3Dv9AHm2k/XRp3sdsxwf/+DNU YB5LrQGpFNNbUWnmkkrhXdUMhawpTXfJ6+xbzaSYskPpeajROVJmAB/aIck0K+JH3soJ HEcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719231; x=1719324031; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q4ELQwjzHA4yApdsWewX3oXEq3EZwSJvDLoYd1jNQ34=; b=tR4nMkREcZ8Awn9lxhIsvBVyEieW4PNT0M5GPQjflET4hdTJPESQVpwroje9L3Ymxj ZEtClSj1EjRQPkpRxO8CG/0lNWOUB3iXTUHVcEiJxLrkWtYlT3E9EyxsKMdTxNKjMOGL 4zfoRevnVw/LiX1bExnfi7mXzkZrMQ3HlIeIV5aV+b5d+kyoqxFiybyG6CY8zZacsE2s KsJ+whuuN5Ecy+VqaKWo0lVzfwKZzRRFLu4G7nvBkhL738j+H2EEX8OVTtivCBavRj0c xcSeqa9hx43lpJ1aAuXNVsT50bxg6L1ydI8lcCr4uMok3HwRLC3Wg/GO7ZjEidpNxvW9 Ru/g== X-Forwarded-Encrypted: i=1; AJvYcCUVs5dF93p/EwERhr7XLYEVB0tl+Hhb/9hKPvDoUhsVJCopONSRlPnw7ps6qXZZuEX35j452vCld8DTS12uDC+uWyHbPhLxbEBY0LLeMfQpQlzGaTgriYAeF/ZYdI9rywWxqFNd+GgOofWTIGa93QRgQJBmCiXP6LdFrmJGFLHLC6n1YiGnkOFpExZEmS0iJ+YjdWTkDo57a3cJlZcieFNbtX/JkhYDcOuhf6OtR1hrHymWlEAZ1g9p7VS2rOAOtfEa2Yxsb1cRqDVmDK36LSJ3HzA+hXL/y7CIVGi5nCPQs41N4S2fwx5bl7g9h1i9DEVtJriwxburcrqvngVxZyu8V6wRQWXqzBN0BnRSETOPKKKb4aTr+8ngGuCy7C67QF4oKKsqiME1w8dnrxoHeA8JOU0B2ziP X-Gm-Message-State: AOJu0YxSn0OKja92Tmq5FI9ORdYeNEm/CNMwhPs2kyD7LyKKpQhO89E0 1JLilEhsZeBohDIKYKfPJenhKNVbe7sUUMjwQ27BbllJPbmPctNI X-Google-Smtp-Source: AGHT+IG56CjchONS6I1JegFr/43CXmjz4UPasXM/HnpGFAACjVWB6VLqx/Impr4a3DUI4prupBUQPg== X-Received: by 2002:a50:998c:0:b0:57c:c171:2fb6 with SMTP id 4fb4d7f45d1cf-57cf7a4e148mr1877504a12.1.1718719231063; Tue, 18 Jun 2024 07:00:31 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:30 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:53 +0300 Subject: [PATCH v3 19/23] power: supply: s2dos05: Add fuel gauge driver for s2dos05 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-19-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719185; l=18925; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=M+uc6GTvoNAckqEvB4YdUBo7gTDSwvEY9HdmtBtM0OA=; b=wYpibWI2SfJGhhqeC25dhyZfx7jwIHK7peeTCQGamB97n/dYfX6y9D6lfjfMafBFp9MtQEP2c PSrkGaJweMFBPaMye7WabuIUy9Ns45BE7DW5DmrdldpFpOVCId66k3E X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add fuel gauge driver for s2dos05 PMIC. It uses adc to measure power on each power output s2dos05 provides, including regulator outputs and AVDD, ELVSS, ELVDD lines. Driver registers power supply for each corresponding power line. Adc can be disabled and enabled via sysfs. Signed-off-by: Dzmitry Sankouski --- MAINTAINERS | 1 + drivers/power/supply/Kconfig | 8 + drivers/power/supply/Makefile | 1 + drivers/power/supply/s2dos05-fg.c | 427 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/s2dos05.h | 123 +++++++++++ 5 files changed, 560 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bee700a5e648..2c5d9a74f977 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19910,6 +19910,7 @@ F: Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml F: drivers/clk/clk-s2mps11.c F: drivers/mfd/s2dos*.c F: drivers/mfd/sec*.c +F: drivers/power/supply/s2dos*.c F: drivers/regulator/s2dos*.c F: drivers/regulator/s2m*.c F: drivers/regulator/s5m*.c diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index a3fdfcb5aa64..22090b150885 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -964,6 +964,14 @@ config CHARGER_SURFACE Microsoft Surface devices, i.e. Surface Pro 7, Surface Laptop 3, Surface Book 3, and Surface Laptop Go. +config FUEL_GAUGE_S2DOS05 + tristate "Power measurement driver for s2dos05 pmic" + depends on MFD_S2DOS_CORE + help + This driver measures power consumption of s2dos05 regulator consumers. + + Say M or Y here to include power measurement ability in s2dos05 pmic. + config BATTERY_UG3105 tristate "uPI uG3105 battery monitor driver" depends on I2C diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile index e1abad8b6b75..fcea83c8aa79 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -113,6 +113,7 @@ obj-$(CONFIG_RN5T618_POWER) += rn5t618_power.o obj-$(CONFIG_BATTERY_ACER_A500) += acer_a500_battery.o obj-$(CONFIG_BATTERY_SURFACE) += surface_battery.o obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o +obj-$(CONFIG_FUEL_GAUGE_S2DOS05) += s2dos05-fg.o obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_pmi8998_charger.o obj-$(CONFIG_FUEL_GAUGE_MM8013) += mm8013.o diff --git a/drivers/power/supply/s2dos05-fg.c b/drivers/power/supply/s2dos05-fg.c new file mode 100644 index 000000000000..d2070f90c80c --- /dev/null +++ b/drivers/power/supply/s2dos05-fg.c @@ -0,0 +1,427 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * s2dos05-fg.c + * + * Copyright (c) 2015 Samsung Electronics Co., Ltd + * http://www.samsung.com + * Copyright (c) 2024 Dzmitry Sankouski + * + */ +#include +#include +#include +#include +#include +#include + +#define SYNC_MODE 1 +#define ASYNC_MODE 2 + +struct s2dos05_fg { + struct regmap *regmap; + struct device *dev; + u8 adc_sync_mode; + struct power_supply *psy_elvdd; + struct power_supply *psy_elvss; + struct power_supply *psy_avdd; + struct power_supply *psy_buck; + struct power_supply *psy_ldo1; + struct power_supply *psy_ldo2; + struct power_supply *psy_ldo3; + struct power_supply *psy_ldo4; +}; + +static const unsigned int power_coeffs[8] = {POWER_ELVDD, POWER_ELVSS, POWER_AVDD, + POWER_BUCK, POWER_L1, POWER_L2, POWER_L3, POWER_L4}; + +static void s2dos05_is_online(struct s2dos05_fg *drv_data, int *val) +{ + unsigned int adc_ctrl2; + + regmap_read(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, &adc_ctrl2); + if ((adc_ctrl2 & ADC_EN_MASK) > 0) + *val = 1; + else + *val = 0; +} + +static void s2dos05_start_measurement_if_async(struct s2dos05_fg *drv_data, unsigned int channel) +{ + unsigned int temp; + + if (drv_data->adc_sync_mode == ASYNC_MODE) { + regmap_read(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL1, &temp); + if (!(temp & PWRMT_EN_CHK)) + return; + + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL1, + ADC_ASYNCRD_MASK, ADC_ASYNCRD_MASK); + usleep_range(2000, 2100); + } +} + +static void s2dos05_adc_read_power(struct s2dos05_fg *drv_data, unsigned int channel, int *val) +{ + unsigned int data_l, data_h, adc_val; + + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, ADC_PTR_MASK, + 2*channel); + regmap_read(drv_data->regmap, S2DOS05_REG_PWRMT_DATA, + &data_l); + + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, ADC_PTR_MASK, + 2*channel+1); + regmap_read(drv_data->regmap, S2DOS05_REG_PWRMT_DATA, + &data_h); + + adc_val = ((data_h & 0xff) << 8) | (data_l & 0xff); + *val = adc_val * power_coeffs[channel] / 100; +} + +static int s2dos05_get_adc_validity(struct s2dos05_fg *drv_data) +{ + unsigned int adc_validity; + + regmap_read(drv_data->regmap, S2DOS05_REG_OCL, &adc_validity); + return !!(adc_validity | ADC_VALID_MASK); +} + +static ssize_t adc_en_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct s2dos05_fg *drv_data = dev_get_drvdata(dev); + unsigned int adc_ctrl3; + + regmap_read(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, &adc_ctrl3); + if ((adc_ctrl3 & ADC_EN_MASK) > 0) + return snprintf(buf, PAGE_SIZE, "ADC enable (%x)\n", adc_ctrl3); + else + return snprintf(buf, PAGE_SIZE, "ADC disable (%x)\n", adc_ctrl3); +} + +static ssize_t adc_en_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct s2dos05_fg *drv_data = dev_get_drvdata(dev); + int ret; + unsigned int temp, val; + + ret = kstrtouint(buf, 16, &temp); + if (ret) + return -EINVAL; + + switch (temp) { + case 0: + val = 0x00; + break; + case 1: + val = 0x80; + break; + default: + val = 0x00; + break; + } + + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, ADC_EN_MASK, + val); + return count; +} + +static ssize_t adc_sync_mode_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct s2dos05_fg *drv_data = dev_get_drvdata(dev); + + switch (drv_data->adc_sync_mode) { + case SYNC_MODE: + return snprintf(buf, PAGE_SIZE, "SYNC_MODE (%d)\n", drv_data->adc_sync_mode); + case ASYNC_MODE: + return snprintf(buf, PAGE_SIZE, "ASYNC_MODE (%d)\n", drv_data->adc_sync_mode); + default: + return snprintf(buf, PAGE_SIZE, "error (%d)\n", drv_data->adc_sync_mode); + } +} + +static ssize_t adc_sync_mode_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct s2dos05_fg *drv_data = dev_get_drvdata(dev); + int ret; + u8 temp; + + ret = kstrtou8(buf, 16, &temp); + if (ret) + return -EINVAL; + + switch (temp) { + case SYNC_MODE: + drv_data->adc_sync_mode = 1; + break; + case ASYNC_MODE: + drv_data->adc_sync_mode = 2; + break; + default: + drv_data->adc_sync_mode = 1; + break; + } + + return count; +} + +static DEVICE_ATTR_RW(adc_en); +static DEVICE_ATTR_RW(adc_sync_mode); + +static int s2dos05_fg_get_property(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val, + unsigned int channel + ) +{ + struct s2dos05_fg *drv_data = power_supply_get_drvdata(psy); + + switch (psp) { + case POWER_SUPPLY_PROP_ONLINE: + s2dos05_is_online(drv_data, &val->intval); + break; + case POWER_SUPPLY_PROP_STATUS: + if (s2dos05_get_adc_validity(drv_data)) + val->intval = POWER_SUPPLY_HEALTH_GOOD; + else + val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE; + break; + case POWER_SUPPLY_PROP_POWER_NOW: + s2dos05_start_measurement_if_async(drv_data, channel); + s2dos05_adc_read_power(drv_data, channel, &val->intval); + break; + default: + return -EINVAL; + } + + return 0; +} + +static int s2dos05_fg_get_property_elvdd(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_ELVDD); +} + +static int s2dos05_fg_get_property_elvss(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_ELVSS); +} + +static int s2dos05_fg_get_property_avdd(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_AVDD); +} + +static int s2dos05_fg_get_property_buck(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_BUCK); +} + +static int s2dos05_fg_get_property_ldo1(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_L1); +} + +static int s2dos05_fg_get_property_ldo2(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_L2); +} + +static int s2dos05_fg_get_property_ldo3(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_L3); +} + +static int s2dos05_fg_get_property_ldo4(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val + ) +{ + return s2dos05_fg_get_property(psy, psp, val, CHANNEL_L4); +} + +static void s2dos05_powermeter_init(struct s2dos05_fg *drv_data) +{ + /* SMP_NUM = 1100(16384) ~16s in case of aync mode */ + regmap_write(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL1, 0x0C); + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, POWER_MODE, + POWER_MODE); + /* ADC EN */ + regmap_update_bits(drv_data->regmap, S2DOS05_REG_PWRMT_CTRL2, + ADC_EN_MASK, ADC_EN_MASK); + +} + +static void s2dos05_powermeter_deinit(struct s2dos05_fg *s2dos05) +{ + /* ADC turned off */ + regmap_write(s2dos05->regmap, S2DOS05_REG_PWRMT_CTRL2, 0); +} + +static enum power_supply_property s2dos05_fg_properties[] = { + POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_POWER_NOW, +}; + +static const struct power_supply_desc s2dos05_elvdd_fg_desc = { + .name = "s2dos05_elvdd", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_elvdd, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_elvss_fg_desc = { + .name = "s2dos05_elvss", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_elvss, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_avdd_fg_desc = { + .name = "s2dos05_avdd", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_avdd, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_buck_fg_desc = { + .name = "s2dos05_buck", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_buck, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_ldo1_fg_desc = { + .name = "s2dos05_ldo1", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_ldo1, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_ldo2_fg_desc = { + .name = "s2dos05_ldo2", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_ldo2, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_ldo3_fg_desc = { + .name = "s2dos05_ldo3", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_ldo3, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static const struct power_supply_desc s2dos05_ldo4_fg_desc = { + .name = "s2dos05_ldo4", + .type = POWER_SUPPLY_TYPE_UNKNOWN, + .get_property = s2dos05_fg_get_property_ldo4, + .properties = s2dos05_fg_properties, + .num_properties = ARRAY_SIZE(s2dos05_fg_properties), +}; + +static int s2dos05_fuelgauge_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct s2dos_core *iodev = dev_get_drvdata(dev->parent); + struct s2dos05_fg *drv_data; + struct power_supply_config pscfg = {}; + int ret; + + drv_data = devm_kzalloc(dev, sizeof(struct s2dos05_fg), + GFP_KERNEL); + if (!drv_data) + ret = -ENOMEM; + + drv_data->regmap = iodev->regmap; + s2dos05_powermeter_init(drv_data); + pscfg.drv_data = drv_data; + + drv_data->psy_elvdd = devm_power_supply_register(dev, &s2dos05_elvdd_fg_desc, &pscfg); + drv_data->psy_elvss = devm_power_supply_register(dev, &s2dos05_elvss_fg_desc, &pscfg); + drv_data->psy_avdd = devm_power_supply_register(dev, &s2dos05_avdd_fg_desc, &pscfg); + drv_data->psy_buck = devm_power_supply_register(dev, &s2dos05_buck_fg_desc, &pscfg); + drv_data->psy_ldo1 = devm_power_supply_register(dev, &s2dos05_ldo1_fg_desc, &pscfg); + drv_data->psy_ldo2 = devm_power_supply_register(dev, &s2dos05_ldo2_fg_desc, &pscfg); + drv_data->psy_ldo3 = devm_power_supply_register(dev, &s2dos05_ldo3_fg_desc, &pscfg); + drv_data->psy_ldo4 = devm_power_supply_register(dev, &s2dos05_ldo4_fg_desc, &pscfg); + + platform_set_drvdata(pdev, drv_data); + + ret = device_create_file(&pdev->dev, &dev_attr_adc_en); + if (ret) { + dev_err(dev, "failed: create adc enable sysfs entry\n"); + goto err; + } + ret = device_create_file(&pdev->dev, &dev_attr_adc_sync_mode); + if (ret) { + dev_err(dev, "failed: create adc sync mode sysfs entry\n"); + goto err; + } + +err: + device_remove_file(dev, &dev_attr_adc_en); + device_remove_file(dev, &dev_attr_adc_sync_mode); + + return 0; +} + +static void s2dos05_fuelgauge_remove(struct platform_device *pdev) +{ + struct s2dos05_fg *info = platform_get_drvdata(pdev); + + s2dos05_powermeter_deinit(info); + + device_remove_file(&pdev->dev, &dev_attr_adc_en); + device_remove_file(&pdev->dev, &dev_attr_adc_sync_mode); +} + +static const struct platform_device_id s2dos05_platform_ids[] = { + {"s2dos05-fg", 0}, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(platform, s2dos05_platform_ids); + +static struct platform_driver s2dos05_platform_driver = { + .driver = { + .name = "s2dos05-fg", + }, + .probe = s2dos05_fuelgauge_probe, + .id_table = s2dos05_platform_ids, + .remove_new = s2dos05_fuelgauge_remove, +}; +module_platform_driver(s2dos05_platform_driver); + +MODULE_DESCRIPTION("s2dos05 power meter"); +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/s2dos05.h b/include/linux/mfd/s2dos05.h new file mode 100644 index 000000000000..8d216064bc78 --- /dev/null +++ b/include/linux/mfd/s2dos05.h @@ -0,0 +1,123 @@ +/* SPDX-License-Identifier: GPL-2.0+ + * s2dos05.h + * + * Copyright (c) 2016 Samsung Electronics Co., Ltd + * http://www.samsung.com + * + */ + +#ifndef __LINUX_MFD_S2DOS05_H +#define __LINUX_MFD_S2DOS05_H +#include +#include + +#define MFD_DEV_NAME "s2dos05" + +struct s2dos05_dev { + struct device *dev; + struct regmap *regmap; +}; + +/* S2DOS05 registers */ +/* Slave Addr : 0xC0 */ +enum S2DOS05_reg { + S2DOS05_REG_DEV_ID, + S2DOS05_REG_TOPSYS_STAT, + S2DOS05_REG_STAT, + S2DOS05_REG_EN, + S2DOS05_REG_LDO1_CFG, + S2DOS05_REG_LDO2_CFG, + S2DOS05_REG_LDO3_CFG, + S2DOS05_REG_LDO4_CFG, + S2DOS05_REG_BUCK_CFG, + S2DOS05_REG_BUCK_VOUT, + S2DOS05_REG_IRQ_MASK = 0x0D, + S2DOS05_REG_SSD_TSD = 0x0E, + S2DOS05_REG_OCL = 0x10, + S2DOS05_REG_IRQ = 0x11 +}; + +/* S2DOS05 regulator ids */ +enum S2DOS05_regulators { + S2DOS05_LDO1, + S2DOS05_LDO2, + S2DOS05_LDO3, + S2DOS05_LDO4, + S2DOS05_BUCK1, + S2DOS05_REG_MAX, +}; + +#define S2DOS05_IRQ_PWRMT_MASK BIT(5) +#define S2DOS05_IRQ_TSD_MASK BIT(4) +#define S2DOS05_IRQ_SSD_MASK BIT(3) +#define S2DOS05_IRQ_SCP_MASK BIT(2) +#define S2DOS05_IRQ_UVLO_MASK BIT(1) +#define S2DOS05_IRQ_OCD_MASK BIT(0) + +#define S2DOS05_BUCK_MIN1 506250 +#define S2DOS05_LDO_MIN1 1500000 +#define S2DOS05_LDO_MIN2 2700000 +#define S2DOS05_BUCK_STEP1 6250 +#define S2DOS05_LDO_STEP1 25000 +#define S2DOS05_LDO_VSEL_MASK 0x7F +#define S2DOS05_LDO_FD_MASK 0x80 +#define S2DOS05_BUCK_VSEL_MASK 0xFF +#define S2DOS05_BUCK_FD_MASK 0x08 + +#define S2DOS05_ENABLE_MASK_L1 BIT(0) +#define S2DOS05_ENABLE_MASK_L2 BIT(1) +#define S2DOS05_ENABLE_MASK_L3 BIT(2) +#define S2DOS05_ENABLE_MASK_L4 BIT(3) +#define S2DOS05_ENABLE_MASK_B1 BIT(4) + +#define S2DOS05_RAMP_DELAY 12000 + +#define S2DOS05_ENABLE_TIME_LDO 50 +#define S2DOS05_ENABLE_TIME_BUCK 350 + +#define S2DOS05_ENABLE_SHIFT 0x06 +#define S2DOS05_LDO_N_VOLTAGES (S2DOS05_LDO_VSEL_MASK + 1) +#define S2DOS05_BUCK_N_VOLTAGES (S2DOS05_BUCK_VSEL_MASK + 1) + +#define S2DOS05_PMIC_EN_SHIFT 6 +#define S2DOS05_REGULATOR_MAX (S2DOS05_REG_MAX) + +/* ----------power meter ----------*/ +#define S2DOS05_REG_PWRMT_CTRL1 0x0A +#define S2DOS05_REG_PWRMT_CTRL2 0x0B +#define S2DOS05_REG_PWRMT_DATA 0x0C +#define S2DOS05_REG_IRQ_MASK 0x0D + +#define CHANNEL_ELVDD 0 +#define CHANNEL_ELVSS 1 +#define CHANNEL_AVDD 2 +#define CHANNEL_BUCK 3 +#define CHANNEL_L1 4 +#define CHANNEL_L2 5 +#define CHANNEL_L3 6 +#define CHANNEL_L4 7 + +#define POWER_ELVDD 24500 +#define POWER_ELVSS 24500 +#define POWER_AVDD 3060 +#define POWER_BUCK 1525 +#define POWER_L1 5000 +#define POWER_L2 5000 +#define POWER_L3 5000 +#define POWER_L4 5000 + +/* S2DOS05_REG_OCL */ +#define ADC_VALID_MASK BIT(7) +/* S2DOS05_REG_PWRMT_CTRL1 */ +#define ADC_ASYNCRD_MASK BIT(7) +#define PWRMT_EN_CHK BIT(6) +#define SMPNUM_MASK 0x0F +/* S2DOS05_REG_PWRMT_CTRL2 */ +#define ADC_EN_MASK BIT(7) +#define ADC_PTR_MASK 0x0F +#define POWER_MODE BIT(4) +#define RAWCURRENT_MODE BIT(5) + +#define S2DOS05_MAX_ADC_CHANNEL 8 + +#endif /* __LINUX_MFD_S2DOS05_H */ From patchwork Tue Jun 18 13:59:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805317 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FF841A072E; Tue, 18 Jun 2024 14:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719238; cv=none; b=TmuQdR5nLMfvF/L1g4v0cgM+H8xhFWuWRZNkBaauX0KKTV1zAg6d/Yb/4a0RnOSL2rAU8lSymbTIlWc47t7mJyRjL1gp6VuhmkpHwkCfES9Pm/fMnGBlIL90sSXgD38WAKbV445xlCV8onRqgAU83YLJf7ICrCNjRQSHlhJZK4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719238; c=relaxed/simple; bh=DzdFdRz1gVcaCMECSJAIQnLBTgojo3XrhxzENnm7+Yk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WZOw+CmrjR7WVu4ZuBp5ZoQKfEvOvfKX7cOMlkw4WA06ijqB/oVG3jPnEB12wzRfsEbXW1i6ukdsk31SlLCvbRqgVTP9H4xUZGzYI4CnEwhaXNcpYP43m52X39uN0wxf4klJvbeNV+3X+QcvtzWar02J6S+98jjh8uBn5KVMt70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JfaEAGfI; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JfaEAGfI" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57cfe600cbeso768035a12.2; Tue, 18 Jun 2024 07:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719236; x=1719324036; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=N8C5cZtO+2UCwtEojtBuXITHFJF0Ul+anrs/LLrVrxk=; b=JfaEAGfIKRlATPRzpxbaRiuXBrbgrA7s3fGaeKJHmFBNdwRg40DYKa3Kji4QyhnplE KN7DZ35sJ6eCHBFaMHKwU198tjmOicefm9ORorV/KxjuTUSFLYsM/RVi6ACmVvAoAxJu onQpG3erUV4yB9rfJHJikzJa3J+y2m/RpwKgUgN/RxlK5Lh9tcifq8iTFFt4ZWwKRmXt CN19Eh2m6OTKAt86aTB/11eMuiAz1xqippqnrnTZYZMmeFgl3Bdr6V4fwwuDLiBCZUor esMfVXSbBZjszgNsyAznla9kZIxsogUXYoAo7S6vDxENt9pQ1TRQ+Ds8iXsGvsunSXZJ TZjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719236; x=1719324036; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N8C5cZtO+2UCwtEojtBuXITHFJF0Ul+anrs/LLrVrxk=; b=upDKPA6cUVRkAL1BBf0PxBwb6U1Lq5DJnqpzjwY7rMFX5vO1RoABLWPKVQDPyVX/mx UC1s8tGRVogDBbF5wxALtVPoRMVHsifxeauLZqo+CCXxqIRsN5EL3A7dLKDul01uc3wU HeCMtaUd4A7mLNO9cL3CG6tcUapgp8kyjpfcHkZw8Ij3B7yZqG7HuCYXZflyJMPzpez9 z5kT7gYH4QS9GhE/M/NFpXDhAvdnhcy/FB5rQXYsW0Ra0Pjevmn75XB3pS4Dv/jlFK30 1BVE1A5pd/8KmRXvcawfsd+gdJDckm13S+xnzlKza8L8cQytITp5HQfqHt3gvwnXOqdV fW8g== X-Forwarded-Encrypted: i=1; AJvYcCWsnbdIP4cOVNb8pA9L0ZR0aqIp8VyGn2DTpiy7JtHPqqdXSN/bN3ybNfD46/PAe8QkHWARr432hlwwzAwJ9+b1BNp4igqs0hl9ZzaQ/Z96KoOrp1XS0oP0D2YTW/uSaURTEcsxVyQz8p9s08ecUpeRgPuVUEbo1oqiVp7PGobnwCS+ZvPSL2Dvwe8G6hADi8+XhLpaabjsuiPS29nBXihSJKVqZb9abewPSRPJH3Ki8EppleGclX1OHvlujrI9Hj8qkg98zL1JXfJ75xa8crcjla+Aj3cR5K3IWheyE8PuWEV5U07cZeiyPRxJ/zsqSAPMIsBx49sZ+xETWI1TGNHvkOnH2VEaM1G9n5JA9LgOhXty9j9WAafsKd940TiFBv5M/f/DvYloVYvXwxI5EnQuxQYuUOjU X-Gm-Message-State: AOJu0YxYA/QopuPhEItJfOXmCSAs8Ayi68vze1L6vY8fQDXMXpBmTZKj Om5TYkkPMvgEwrk7WvlEdTb1b6XSEjdVpsFv0kG8YSQgFj3v7Qai X-Google-Smtp-Source: AGHT+IHQorFEBelRVlnJYSg0Nj0exKGkeoGt+vHNChz4s1U63SUJqDJ4IXGFzwDNCjEMHQbzrx2ZIw== X-Received: by 2002:a50:ab4a:0:b0:578:6c19:4801 with SMTP id 4fb4d7f45d1cf-57cbd6a70e9mr8232985a12.22.1718719235560; Tue, 18 Jun 2024 07:00:35 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:35 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:55 +0300 Subject: [PATCH v3 21/23] arm64: dts: qcom: starqltechn: remove framebuffer Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-21-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719185; l=914; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=DzdFdRz1gVcaCMECSJAIQnLBTgojo3XrhxzENnm7+Yk=; b=V19181JL5PJh1FZxnidHS2IZyd3Qo7EGVRrt7RJyFup2Mg4Or7+mluh4O8nPJterG1dcIbP87 yDealaQ5i9cA12cOnIJfdiYlbhP/WAfUNEcsJ0zd6HRE5SQ9Rep2O3Z X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Remove framebuffer because a panel driver introduced. Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 6fc30fd1262b..578798704577 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -19,15 +19,6 @@ / { chosen { #address-cells = <2>; #size-cells = <2>; - ranges; - framebuffer: framebuffer@9d400000 { - compatible = "simple-framebuffer"; - reg = <0 0x9d400000 0 (2960 * 1440 * 4)>;//2400000 - width = <1440>; - height = <2960>; - stride = <(1440 * 4)>; - format = "a8r8g8b8"; - }; }; vph_pwr: vph-pwr-regulator { From patchwork Tue Jun 18 13:59:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 805316 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F13531A2554; Tue, 18 Jun 2024 14:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719244; cv=none; b=Fh7LFtKx621sxGVo2elyxiUZFEAyzCr9HB00gKMlj4bVsOUBmORTgrCaJii5QDoDlhIO58MGzsv9mkVua+PdhgpsTctpMdVwI5g+ZYjYbsOkgpte+Z7kqllic7BVtqvgnvAbMLu/xDQ6B2Rdyu+0n77xucSMx7c3IFhxHEcmdXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718719244; c=relaxed/simple; bh=ZW5/h6ouVrrBXLRGXUEoLufARTLrpkHg1IiP7Xktm9k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z/aD/rXCwkiN9Tz80cajk4ttruVip3lOy5phcEIJDKTjoiUyQ6YPYMMS8l+SjJEEJES6pM6qGjfWuke8GCgbQEMCCHg/E73lGu2tDNeWDzDiK1c1DM5D8r3amCKueA2AUGs3pfeuta7SLzmdaEFa/hpowpDCgW5cESDCmdIdtaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U0QlxwI/; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U0QlxwI/" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a6efe62f583so550785766b.3; Tue, 18 Jun 2024 07:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719240; x=1719324040; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QnGqb9LdUpFo9CK6p9zAXnt5zDSobIuIEOWLz7JLT7A=; b=U0QlxwI/tihEiubah6Vzp1+ce+sVmwEPPKIGRk1FzOj6z2B3dP+0WAzIO+DQWj7n4k 6czhZuYAuJdWFM84YjSJ9QaT/x74YiXel8wJFEpkiNiqUACGgCj1YXpSsCtY9cRAWIUY e6FAoYIAllNiGalmOkgfJCQVdRVFGA0vGCeZM47HbDK5E6e5EObyzI8COWBEv2LgTPzw MhwlAMW7NDUvwNx1CCcBq6pDK/jXOvWvkoNYqKtM39AagBMeWC4r8R8WZ4ZNhTqWUxMM 9DSyY4SfY3at608x2wVXvYr/JfH9e2oz8L2vBSoF9Egwk/oLgdIh5fGNY6DbhKFmsLaO ITqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719240; x=1719324040; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QnGqb9LdUpFo9CK6p9zAXnt5zDSobIuIEOWLz7JLT7A=; b=WlXPFtUOCN4kEIGNxR1GVk9RTvJgqxXqFRI0Q/l+84c7MsZFwnxSgsKjL/XtG+Cqro lol5nJaZ5geVIWf9d9sx+uViie40UZ9pEPd4gm1Zbf/hOplAGAgaejDa2EwwubZLoXRC NwzNHG0TctFefN5IkXdDlORdaZfU5f1UVUj8RQSpWBKFBrzzsjjf0xeAyuBFC1du1vZZ bklbEA2XBxEnRLmFHJKeeH6u+AEz99urTK8WQI7H5ya0kVTL4LE5EdKVcSzCVp8WjJ/y xmbHTBf0kWJFaKRJ3CRXbGYvgNpNfs4oO9IvwQC6p4WUYRKkPO3Y5pveRlYcjCIcCcZ9 4MIg== X-Forwarded-Encrypted: i=1; AJvYcCUOzjm0syPWD5FEPaA++GS9K7ojk7LxQK4u7B86EyIQPhzUMy2jkgncCLqI2eAXEAS1gif+kQJ+E4kPecp10PCEIcK0ct0yvYgL+zU6VJ2SGK+JUKELMnscFXoYl6lenVOGOhjGwpkRhygN0/pIS2iNIZl1I55cNrkYba8y7fCzHKpRolRDumJi2Q11jrMfQNljJadIv6v1gyntvVkKuPHLBiMRq0VzMZg7NAzqCtMyz7zZyLJ6ch3DnO6Z3nPDMaHN5uBxq8fKBp6P12n7d1BZAQ3SFYR/ukprnnu3kQgA7NU3NA/g84l7sHr/wKwixuMc5eeVd0pbu0COgWCuPfqAPUl1VjRsJl4Vgdc67x+HQA4Jqr9k0ahs8ssCn/0hUDH2x0TeBfK/xgyZ5BMd6z82+SGTJuAV X-Gm-Message-State: AOJu0YxTvrqxaqHM+QSw2ms0edPkGMdvSb3IX/Lrz9IWJvNlZ3RHtr6D EYx80do7iaXmUj4kPg6uRfabsW1g88euqRYk18j/2eLrshhQHTZA X-Google-Smtp-Source: AGHT+IGPPiSPuLy3CAfkI5tf48nr72YmeYQ5pug2vxNgFfhWd7s15QYH+/yq15N13UcYtqPTSjDbdw== X-Received: by 2002:a17:906:fa92:b0:a6f:15c9:9aa3 with SMTP id a640c23a62f3a-a6f60de1b3bmr859682766b.67.1718719239981; Tue, 18 Jun 2024 07:00:39 -0700 (PDT) Received: from [127.0.1.1] (mm-167-232-122-178.mgts.dynamic.pppoe.byfly.by. [178.122.232.167]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm7731278a12.22.2024.06.18.07.00.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:00:39 -0700 (PDT) From: Dzmitry Sankouski Date: Tue, 18 Jun 2024 16:59:57 +0300 Subject: [PATCH v3 23/23] arm64: dts: qcom: starqltechn: add new features Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240618-starqltechn_integration_upstream-v3-23-e3f6662017ac@gmail.com> References: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> In-Reply-To: <20240618-starqltechn_integration_upstream-v3-0-e3f6662017ac@gmail.com> To: Sebastian Reichel , Bjorn Andersson , Michael Turquette , Stephen Boyd , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lee Jones , Dmitry Torokhov , Pavel Machek , Liam Girdwood , Mark Brown , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Krzysztof Kozlowski , Konrad Dybcio , Chanwoo Choi , phone-devel@vger.kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Dzmitry Sankouski X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1718719185; l=14368; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=ZW5/h6ouVrrBXLRGXUEoLufARTLrpkHg1IiP7Xktm9k=; b=U7LweIymrYPIlyG7gXxJdMjzBRSF9CyuuijIHSfWGI1INzjWG3kWUggSD713gpauIFc9HFIJM 6Vq2DvNHAp8CkSNIR6sq7/le6ye4aYaxRLQkXGrquoTHhCMCM0ZuPpm X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for new features: - sound (headphones and mics only) - gpu - panel - buttons - MAX77705 MFD:    - charger    - fuelgauge    - haptic    - led Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 593 ++++++++++++++++++++- 1 file changed, 592 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index bad154b1e894..28a5210e22fb 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -7,15 +7,40 @@ /dts-v1/; +#include #include #include +#include +#include + #include "sdm845.dtsi" +#include "pm8998.dtsi" +#include "sdm845-wcd9340.dtsi" + +/delete-node/ &rmtfs_mem; +/delete-node/ &adsp_mem; +/delete-node/ &slpi_mem; +/delete-node/ &spss_mem; / { chassis-type = "handset"; model = "Samsung Galaxy S9 SM-G9600"; compatible = "samsung,starqltechn", "qcom,sdm845"; + aliases { + serial0 = &uart9; + }; + + battery: battery { + compatible = "simple-battery"; + constant-charge-current-max-microamp = <2150000>; + charge-full-design-microamp-hours = <3000000>; + + over-voltage-threshold-microvolt = <4500000>; + voltage-min-design-microvolt = <3400000>; + voltage-max-design-microvolt = <4350000>; + }; + chosen { #address-cells = <2>; #size-cells = <2>; @@ -59,9 +84,199 @@ memory@a1300000 { ftrace-size = <0x40000>; pmsg-size = <0x40000>; }; + + /* The rmtfs_mem needs to be guarded due to "XPU limitations" + * it is otherwise possible for an allocation adjacent to the + * rmtfs_mem region to trigger an XPU violation, causing a crash. + */ + rmtfs_lower_guard: memory@fde00000 { + no-map; + reg = <0 0xfde00000 0 0x1000>; + }; + + rmtfs_mem: rmtfs-mem@fde01000 { + compatible = "qcom,rmtfs-mem"; + reg = <0 0xfde01000 0 0x200000>; + no-map; + + qcom,client-id = <1>; + qcom,vmid = <15>; + }; + + rmtfs_upper_guard: rmtfs-upper-guard@fe001000 { + no-map; + reg = <0 0xfe001000 0 0x1000>; + }; + + /* + * It seems like reserving the old rmtfs_mem region is also needed to prevent + * random crashes which are most likely modem related, more testing needed. + */ + removed_region: removed-region@88f00000 { + no-map; + reg = <0 0x88f00000 0 0x1c00000>; + }; + + slpi_mem: slpi@96700000 { + reg = <0 0x96700000 0 0xf00000>; + no-map; + }; + + spss_mem: spss@97700000 { + reg = <0 0x97700000 0 0x100000>; + no-map; + }; + + adsp_mem: memory@97800000 { + reg = <0 0x97800000 0 0x2000000>; + no-map; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + autorepeat; + + key-vol-up { + label = "volume_up"; + gpios = <&pm8998_gpios 6 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <15>; + }; + + key-wink { + label = "key_wink"; + gpios = <&pm8998_gpios 19 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <15>; + }; + }; + + i2c21 { + compatible = "i2c-gpio"; + sda-gpios = <&tlmm 127 GPIO_ACTIVE_HIGH>; + scl-gpios = <&tlmm 128 GPIO_ACTIVE_HIGH>; + i2c-gpio,delay-us = <2>; + pinctrl-0 = <&i2c21_sda_state &i2c21_scl_state>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + pmic@60 { + compatible = "samsung,s2dos05-pmic"; + reg = <0x60>; + + regulators { + s2dos05_ldo1: ldo1 { + regulator-name = "s2dos05-ldo1"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <2000000>; + regulator-active-discharge = <1>; + }; + + s2dos05_ldo2: ldo2 { + regulator-name = "s2dos05-ldo2"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-active-discharge = <1>; + regulator-boot-on; + }; + + s2dos05_ldo3: ldo3 { + regulator-name = "s2dos05-ldo3"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-active-discharge = <1>; + regulator-boot-on; + }; + + s2dos05_ldo4: ldo4 { + regulator-name = "s2dos05-ldo4"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3775000>; + regulator-active-discharge = <1>; + }; + + s2dos05_buck1: buck1 { + regulator-name = "s2dos05-buck1"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <2100000>; + regulator-active-discharge = <1>; + }; + }; + }; + }; + + vib_regulator: gpio-regulator { + compatible = "regulator-fixed"; + regulator-name = "haptic"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + enable-active-high; + gpio = <&pm8998_gpios 18 GPIO_ACTIVE_HIGH>; + }; + + vib_pwm: pwm { + #pwm-cells = <2>; + compatible = "clk-pwm"; + clocks = <&gcc GCC_GP1_CLK>; + pinctrl-0 = <&motor_pwm_default_state>; + pinctrl-1 = <&motor_pwm_suspend_state>; + pinctrl-names = "default", "suspend"; + }; +}; + +&gmu { + status = "okay"; +}; + +&gpu { + status = "okay"; + + zap-shader { + memory-region = <&gpu_mem>; + firmware-name = "qcom/sdm845/starqltechn/a630_zap.mbn"; + }; +}; + +&mdss { + status = "okay"; +}; + +&mdss_dsi0 { + vdda-supply = <&vreg_l26a_1p2>; + status = "okay"; + + panel@0 { + compatible = "samsung,s6e3ha8"; + reg = <0>; + vci-supply = <&s2dos05_ldo4>; + vddr-supply = <&s2dos05_buck1>; + vdd3-supply = <&s2dos05_ldo1>; + te-gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>; + reset-gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&sde_dsi_default &sde_te>; + pinctrl-1 = <&sde_dsi_suspend &sde_te>; + pinctrl-names = "default", "suspend"; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; }; }; +&mdss_dsi0_out { + data-lanes = <0 1 2 3>; + remote-endpoint = <&panel_in>; +}; + +&mdss_dsi0_phy { + vdds-supply = <&vdda_mipi_dsi0_pll>; + status = "okay"; +}; &apps_rsc { regulators-0 { @@ -355,10 +570,72 @@ &qupv3_id_1 { status = "okay"; }; +&gpi_dma0 { + status = "okay"; +}; + +&gpi_dma1 { + status = "okay"; +}; + &uart9 { status = "okay"; }; +&i2c14 { + status = "okay"; + + pmic@66 { + compatible = "maxim,max77705"; + reg = <0x66>; + interrupt-parent = <&pm8998_gpios>; + interrupts = <11 IRQ_TYPE_LEVEL_LOW>; + interrupt-names = "max77705_irq"; + pinctrl-0 = <&chg_int_default>; + pinctrl-names = "default"; + + leds { + compatible = "maxim,max77705-led"; + #address-cells = <1>; + #size-cells = <0>; + + led@1 { + reg = <1>; + label = "red:usr1"; + }; + + led@2 { + reg = <2>; + label = "green:usr2"; + }; + + led@3 { + reg = <3>; + label = "blue:usr3"; + }; + }; + + max77705_charger: charger { + compatible = "maxim,max77705-charger"; + monitored-battery = <&battery>; + }; + + fuelgauge { + compatible = "maxim,max77705-fg"; + monitored-battery = <&battery>; + power-supplies = <&max77705_charger>; + rsense = <5>; + }; + + + haptic { + compatible = "maxim,max77705-haptic"; + haptic-supply = <&vib_regulator>; + pwms = <&vib_pwm 0 50000>; + }; + }; +}; + &ufs_mem_hc { reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>; vcc-supply = <&vreg_l20a_2p95>; @@ -373,14 +650,241 @@ &ufs_mem_phy { }; &sdhc_2 { - pinctrl-names = "default"; pinctrl-0 = <&sdc2_clk_state &sdc2_cmd_state &sdc2_data_state &sd_card_det_n_state>; + pinctrl-names = "default"; cd-gpios = <&tlmm 126 GPIO_ACTIVE_LOW>; vmmc-supply = <&vreg_l21a_2p95>; vqmmc-supply = <&vddpx_2>; status = "okay"; }; +&i2c11 { + clock-frequency = <400000>; + status = "okay"; + + touchscreen@48 { + compatible = "samsung,s6sy761"; + reg = <0x48>; + interrupt-parent = <&tlmm>; + interrupts = <120 IRQ_TYPE_LEVEL_HIGH>; + vdd-supply = <&s2dos05_ldo2>; + avdd-supply = <&s2dos05_ldo3>; + + pinctrl-0 = <&touch_irq_state>; + pinctrl-names = "default"; + }; +}; + +&adsp_pas { + firmware-name = "qcom/sdm845/starqltechn/adsp.mbn"; + status = "okay"; +}; + +&lpasscc { + status = "okay"; +}; + +&wcd9340 { + reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>; + vdd-buck-supply = <&vreg_s4a_1p8>; + vdd-buck-sido-supply = <&vreg_s4a_1p8>; + vdd-tx-supply = <&vreg_s4a_1p8>; + vdd-rx-supply = <&vreg_s4a_1p8>; + vdd-io-supply = <&vreg_s4a_1p8>; + qcom,micbias1-microvolt = <1800000>; + qcom,micbias2-microvolt = <2700000>; + qcom,micbias3-microvolt = <1800000>; + qcom,micbias4-microvolt = <1800000>; +}; + +&sound { + compatible = "qcom,sdm845-sndcard"; + model = "Samsung Galaxy S9"; + pinctrl-0 = <&quat_mi2s_active &quat_mi2s_sd0_active &quat_mi2s_sd1_active>; + pinctrl-names = "default"; + status = "okay"; + + audio-routing = "RX_BIAS", "MCLK", + "AMIC2", "MIC BIAS2", /* Headset Mic */ + "AMIC3", "MIC BIAS2", /* FMLeft Tx */ + "AMIC4", "MIC BIAS2", /* FMRight Tx */ + "DMIC0", "MIC BIAS1", /* Digital Mic0 */ + "DMIC5", "MIC BIAS4", /* Digital Mic1 */ + "DMIC4", "MIC BIAS4", /* Digital Mic2 */ + "DMIC3", "MIC BIAS3", /* Digital Mic3 */ + "DMIC2", "MIC BIAS3", /* Digital Mic4 */ + "DMIC1", "MIC BIAS1"; /* Digital Mic5 */ + + mm1-dai-link { + link-name = "MultiMedia1"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>; + }; + }; + + mm2-dai-link { + link-name = "MultiMedia2"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>; + }; + }; + + mm3-dai-link { + link-name = "MultiMedia3"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA3>; + }; + }; + + mm4-dai-link { + link-name = "MultiMedia4"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA4>; + }; + }; + + mm5-dai-link { + link-name = "MultiMedia5"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA5>; + }; + }; + + mm6-dai-link { + link-name = "MultiMedia6"; + cpu { + sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA6>; + }; + }; + + slim-dai-link { + link-name = "SLIM Playback 1"; + cpu { + sound-dai = <&q6afedai SLIMBUS_0_RX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&wcd9340 0>; + }; + }; + + slimcap-dai-link { + link-name = "SLIM Capture 1"; + cpu { + sound-dai = <&q6afedai SLIMBUS_0_TX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&wcd9340 1>; + }; + }; + + slim2-dai-link { + link-name = "SLIM Playback 2"; + cpu { + sound-dai = <&q6afedai SLIMBUS_1_RX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&wcd9340 2>; /* AIF2_PB */ + }; + }; + + slimcap2-dai-link { + link-name = "SLIM Capture 2"; + cpu { + sound-dai = <&q6afedai SLIMBUS_1_TX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&wcd9340 3>; /* AIF2_CAP */ + }; + }; + + slimcap3-dai-link { + link-name = "SLIM Capture 3"; + cpu { + sound-dai = <&q6afedai SLIMBUS_2_TX>; + }; + + platform { + sound-dai = <&q6routing>; + }; + + codec { + sound-dai = <&wcd9340 5>; /* AIF3_CAP */ + }; + }; +}; + +&q6afedai { + dai@22 { + reg = <22>; + qcom,sd-lines = <1>; + }; + + dai@23 { + reg = <23>; + qcom,sd-lines = <0>; + }; +}; + +&q6asmdai { + dai@0 { + reg = <0>; + }; + + dai@1 { + reg = <1>; + }; + + dai@2 { + reg = <2>; + }; + + dai@3 { + reg = <3>; + }; + + dai@4 { + reg = <4>; + }; + + dai@5 { + reg = <5>; + }; +}; + +/* Modem/wifi */ +&mss_pil { + firmware-name = "qcom/sdm845/starqltechn/mba.mbn", + "qcom/sdm845/starqltechn/modem.mbn"; + status = "okay"; +}; + +&ipa { + qcom,gsi-loader = "self"; + memory-region = <&ipa_fw_mem>; + firmware-name = "qcom/sdm845/starqltechn/ipa_fws.mbn"; + status = "okay"; +}; + &usb_1 { status = "okay"; }; @@ -408,9 +912,45 @@ &usb_1_qmpphy { status = "okay"; }; +&pm8998_resin { + linux,code = ; + status = "okay"; +}; + +&pm8998_gpios { + chg_int_default: chg-int-default-state { + pins = "gpio11"; + function = "normal"; + input-enable; + bias-disable; + power-source = <0>; + }; +}; + &tlmm { gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>; + sde_dsi_default: sde-dsi-default-state { + pins = "gpio6"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + }; + + sde_dsi_suspend: sde-dsi-suspend-state { + pins = "gpio6"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + + sde_te: sde-te-state { + pins = "gpio10"; + function = "mdp_vsync"; + drive-strength = <2>; + bias-pull-down; + }; + sdc2_clk_state: sdc2-clk-state { pins = "sdc2_clk"; bias-disable; @@ -439,4 +979,55 @@ sd_card_det_n_state: sd-card-det-n-state { function = "gpio"; bias-pull-up; }; + + motor_pwm_default_state: motor-pwm-active-state { + pins = "gpio57"; + function = "gcc_gp1"; + drive-strength = <2>; + bias-disable; + output-high; + }; + + motor_pwm_suspend_state: motor-pwm-suspend-state { + pins = "gpio57"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + output-low; + }; + + i2c21_sda_state: i2c21-sda-state { + pins = "gpio127"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + i2c21_scl_state: i2c21-scl-state { + pins = "gpio128"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + touch_irq_state: touch-irq-state { + pins = "gpio120"; + function = "gpio"; + bias-disable; + }; +}; + +&qup_uart9_tx { + drive-strength = <2>; + bias-pull-up; +}; + +&qup_uart9_rx { + drive-strength = <2>; + bias-pull-up; +}; + +&qup_i2c11_default { + drive-strength = <2>; + bias-disable; };