From patchwork Fri Sep 13 15:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828252 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 17B863D0AD; Fri, 13 Sep 2024 15:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240095; cv=none; b=ImPeI/8HZlBR4hGn3oXuzZi5sC30rE31eytcpgynDqNNBL+7UNsb/h6cFfK6ltBDvYS7zHAKE9oSvEGZzZ3Hotau7PdXWwSoSI7dkZKkH2Qajw1gcnkOxHA/DbqROTpbvieytJ0AXkO6QMIF+lNCpXlgFhMvJpOU5GbhAA+Qfc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240095; c=relaxed/simple; bh=ddijmglUy+4wekTGyDAt+CkBz5h456H3akY2zm7U9hc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BDxIhK+p37b0lhoY9gfgOpGokm24mfhG1gFmT5OHVqcdHepRwXJsezyZrcIgPAYg2Wb0oe+eF/wlQlsjMO5ON8YYhSk0mFb4Bk0IldT8TZImjnyk5hNdZs0F6ipMxmI4nxC2eAI2fjfzm/nXtyVk4V/hgXppReZ5mFu30KnxkkY= 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=PUfv07vM; arc=none smtp.client-ip=209.85.208.54 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="PUfv07vM" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-5c245c62362so2529252a12.0; Fri, 13 Sep 2024 08:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240092; x=1726844892; 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=4EIqNkwsQqZA2boWTxgOSCM1LnprICOAsFLvJ5jdzT0=; b=PUfv07vMxzXAQmWC0zclH/PwcHKTnBdAJ1b0UG1hE5a7gANLNoGK5p3eOd1VdOBxn4 zuy0OOXCiwSF8fyDgb8cETGMDq9q/44myZPgEBr0VtcnrQTpSdWM+z/TxAn9MVz4CyiJ h/ezzVVPKOs3gTZXlS9/uuBIe/6glA/6/PMD5yz0yS4GiFWnd78MioB32Kql3dQfu/+n NnJzTD1UdpdYz2pS2mH64SznhaFEJsmM2gWqFCKp5t+9pFDzjlbKZhgBbSdq9RxZ1Unv YPuvXP5wKIbSeL/DmjZK3b843PNlK8b1N824p7DcQw9SYYZBTy22/sDE8fbz4/ZMN0xV jzog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240092; x=1726844892; 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=4EIqNkwsQqZA2boWTxgOSCM1LnprICOAsFLvJ5jdzT0=; b=tNRBBMOoVJDzP+5XPOwXJMFQIkzF3SiR34+BXmK1CSMoDF9Z78zhoFrm8wAnApqGgt BE6SNY+ty5hqg/Qqj8UtlpR1GezSUvGFwFFb8oH6A2fJm1kCer3P9N38Vefd+hWLIVj8 dB2aAStv4prVgG7thFtn+3wJ2o5EhspOnBfTQyyjfQEdZdWeoo97pg6gY0M98JWfLT3v xvJsrpJQOxjt4fSWwtZJwhfSpU9OLDCWZYj6PjKdFfvFfuT/xgqAtO0oPHgBpjQgkRGv sNZRhg3Ss7mGupZbPKct1nBvT2ZXlrEOnH2BAptbsCiG9Brv4DXtxiT5gHbA08IAKOjE FCMg== X-Forwarded-Encrypted: i=1; AJvYcCUIYerf1kX+OlJ0leelh6AvWIjVeYcEzLXSpfle7zGnUVGU0nCz5SMIpIaaXhvAtEpooN3ICwAAF12o@vger.kernel.org, AJvYcCUPIySp9ApQiqanJ1P2soNl+0WfvhO3rOAcWrL9C8A6bDJB8T+chjfpgzinXzMjT3PHDXFkjtSrUfj1@vger.kernel.org, AJvYcCUxRgbiNcSIergkMJ4BnT50uLnn20jvo3fdLxQ1iGANSJCAWSALKwaTFzjGYEerWXxSDTCTFDKNyQaRnkf35dUet/g=@vger.kernel.org, AJvYcCWKqrf9EKEUnAHzb4BQqO0dIMuOA0Z8MfFGXR2aCPvD72JOQ7TVkSJ5q8hmPmNtubKELpI1x4Onqj4r8Q==@vger.kernel.org, AJvYcCWdN4weG3nvnOhmN9C3vkZjw8UMxqtyZsvzILrDifE2vD5Yw1+o+LjOc/yFEdA68T0mrQM6aWAcdfG4t4E=@vger.kernel.org, AJvYcCWhYx5Hjcm8LPofHemo9nSWV6eAkH+P+kEom5zqel3hihWvhNRIk4FuayRniRkQf2AjpnBmx4nMcVgELwFXRQ==@vger.kernel.org, AJvYcCXjyXGUmUJx1t8F0yv78fU41kwY6BTdmjetUd8hSF112r1E45QYWiCSR6gketgcUAHpz+wJkvBsMH6j@vger.kernel.org, AJvYcCXrYkj/1Js3ng5CJUkZPzYhpVzcEB/b6Uurv9x6jdxrXYQletRwRwsY+CbgS5dd92ikITL42iFQeDS/Z23Y@vger.kernel.org X-Gm-Message-State: AOJu0YzLL81ynxe8o4/nQf1N/fDovgdInyOmoKmm/XxwjHnfBJTI2/7i YJbkSeRYsArQ8xxVN66dQVtRUlZYo838wC1i4yQzB0q/FC8Z1rEIwGKE5g== X-Google-Smtp-Source: AGHT+IE6p8oIHSJsZjO2mqGheGUSLlmJW/eDkgrNE2S89U66htUkE0mJEAHFXlxpzTiGrpsFC3Ltvg== X-Received: by 2002:a05:6402:1d53:b0:5c2:7570:3a2a with SMTP id 4fb4d7f45d1cf-5c413e1ee8cmr5399227a12.17.1726240092072; Fri, 13 Sep 2024 08:08:12 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:11 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:44 +0300 Subject: [PATCH v4 01/27] 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: <20240913-starqltechn_integration_upstream-v4-1-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=718; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=ddijmglUy+4wekTGyDAt+CkBz5h456H3akY2zm7U9hc=; b=DUew05PYQEnECXRBoPaNkYafjbSQTw/TzmdaaO86R3ABKGSwEcD3aOOWmE9UYWH8XHLI1cCOW 1spV1CZGhufDOpTXp/PEROc9GP7fFhmLUklqPu3P8Cey+x4U1/xnzm/ 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 910d407ebe63..8682e6466544 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 Fri Sep 13 15:07: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: 828682 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 7D9475B69E; Fri, 13 Sep 2024 15:08:17 +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=1726240099; cv=none; b=nHwisYDTyBmdoODHY2FL3OnR48LB0dFNXX8/YDNpfj7DUM95d9qzWermEvCXq26RLm8hmkFenwZbu6B5p0Ddy58y0b3oJjWuDwPfluIzZXXsp2R+U94Gfof/3xp3IPPYtS8KI1HAjQ55BPAysuXyO0Mcf26Yyv+BO9VsqE1gQa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240099; c=relaxed/simple; bh=F7p2yDZX6Sya67BXEAuRzruxuOCCYpvbHrlwx0Qk5Xw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cOKQIa5PG4nz1zITHl5Tf6+SqjiX+zKf07A07xoBg0RZqHsSyA7igQ1F3y6YQFf8qiH5faVkU29fBwrRu1bKabghCFMKN38+keR4m0OdH7Ex3UqHM5yHZ5iJyq4/FCw2lbikW6r9V70MxZ2XK3hUJRHCKAXXIEiN5TnclJuVgIk= 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=M0DslaXe; 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="M0DslaXe" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5becd359800so1944194a12.0; Fri, 13 Sep 2024 08:08:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240095; x=1726844895; 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=17HIqgHEbThobLns0AtRzm3Gh6YORVy/AgMlLUCbkoU=; b=M0DslaXepV17r2KAgB92KeDltP8dD459gsRAlZV6WWmebH50sQlVlNvTCevEwE4gyh Fraw7guQcaSne57t/EfFy/rEdFOHn7NKTrR77SxPva91D6+wfL24bJE/1ARkByrJh1EJ 3D8XGZkC22m38tyGCH24I6qv1AHY27xta2dTouXmvWfBb2qngN//4hpu5It8bJzn1H6S QMOooK0WPnej4PsBWN8UE5FXqbVQHmWlmmaZw1PCt4u+FQUYQ/oOavbFvu2h5+db9oou Y2xVl0jMPPznFynQoA64dP/taYDRVYOmjuvPMuIXZ94QyNTOJcIQMDxEKr/2vY4OzNPg o1tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240095; x=1726844895; 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=17HIqgHEbThobLns0AtRzm3Gh6YORVy/AgMlLUCbkoU=; b=Mx0A5taw5E0htGlGrOHZ+udXsKbq3cODo/nTmx7cPQPM5ZQBO8lKtwU6NZURsZykKN /pmY+FgEMtqBng9BKlkVZq0aWb8EPZgo8Fw7n59xhlrmoAAHrZIWl45hn4WsXPqs7ZiP 2TiPNe75lAB8UQTcqRR4ezP0UfyU8F8jrnqdvts8Dy1sqvEm5Er4PrxZ53qaciDOczE9 JcsFH53aGBeGdq2mTiFa/1278bFOKSZA1FkGAtFp7bUOmN/Ycf6jgYD8CNeQV02sdLRI Zwx4BhgInyXRYdespMu2I9OOmuxmYrMeEvCaYtaACtUl5P0Ud0qCFSGnUYDNA1KLGKs9 SPxw== X-Forwarded-Encrypted: i=1; AJvYcCUF7ctIV4sLAz9IYot+03NkdJwJ9IF3IKi+bcTkx1w9+EJKqg21eknHLBvunYiM0p2ypUrGMVybDH4cI+I5@vger.kernel.org, AJvYcCVzYqlntyEoLClPhUot7aHD/iNF+b9M3YARySuYfNSpucAx56iPgNZC7e23scirTKz60SzUBit40Y03D51itg==@vger.kernel.org, AJvYcCWHEYgmmt5vy7W/RHDrlcGf50xo6Yf+WTGTN7WC8cteEGycUb9agnjKUWW5V8Ig2lh/NrJ5NnoYaaqNPGU/Ufs2Lzg=@vger.kernel.org, AJvYcCWURu5xoTWJhKX5bkCWV53UOAelfgusmO8oK3Sj6p1+aYTunAId9yHnkrgXQeVGDhD5cQNBUc0javEc@vger.kernel.org, AJvYcCWYm9dhWSGc18ZESWqHW2SVCLzGbOUsO1LVUOjFW1mKz9LJuMVrD8ZoqnV2rpqGXUfvVrqM88ugM++D@vger.kernel.org, AJvYcCWfYehgntY8p7n+LT7lf2vI6fO2RNU7/uTxehdd+aTUBRsVya+xlMCndc9bDvr3Yty8MYIzzTUNEQGzIQ==@vger.kernel.org, AJvYcCXIMVyoNGUEirNU8RE+Js9UAcotk+m97DoMCWMuYHfPeZvlLAJ6W/ZhwyJFmeDmoUeDjRUnJtub7t1D@vger.kernel.org, AJvYcCXyn0Dk0E+J9QQd59odY/qh9fMHi6NGp5T76T60qcMhEN3Kx3LQ0A4q+H7lrb15LRoCdUMjv0FVtMbFYIk=@vger.kernel.org X-Gm-Message-State: AOJu0YyUUxN8cR7opfzdIVU+TNVAUQkmRc6zwepwrFrEx9M9wjEXWpHc 63rihyv7khQOLO2nu2irxhrzPSJA4UbgTAFAZsj8wHVAWKB9UcwA+b8Qyw== X-Google-Smtp-Source: AGHT+IFDbC8+nUawUMDJPpP2JLghGCONKzB2EfXKphKzb7uTXnNY8L/6PXyI8AxG1Fm4mo7AugZ4Sw== X-Received: by 2002:a05:6402:321c:b0:5c2:7699:fb6f with SMTP id 4fb4d7f45d1cf-5c413e1fd66mr5471806a12.15.1726240095178; Fri, 13 Sep 2024 08:08:15 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:14 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:45 +0300 Subject: [PATCH v4 02/27] clk: qcom: clk-rcg2: name refactoring Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-2-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=5100; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=F7p2yDZX6Sya67BXEAuRzruxuOCCYpvbHrlwx0Qk5Xw=; b=H2NvLNTPj7u92aGj5k/qH9fs4vwopERJbMgTGRwgJ7VcGSb9+DZpGWgBeVZEvfQyJmUe/SAq0 RNfeeA23vU6Bl7I5B+F13MmTD7sKXj57kJp1Kabm5UJBCEfzvlNmWF0 X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= clk-rcg2.c uses 2 variable names for pre divisor register value: pre_div and hid_div. Replace hid_div with pre_div. Update calc_rate docs to reflect, that pre_div is not pure divisor, but a register value, and requires conversion. Signed-off-by: Dzmitry Sankouski --- drivers/clk/qcom/clk-rcg2.c | 51 ++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index bf26c5448f00..df491540ef39 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -153,13 +153,20 @@ static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index) * * parent_rate m * rate = ----------- x --- - * hid_div n + * pre_div_pure n + * + * @param rate - Parent rate. + * @param m - Multiplier. + * @param n - Divisor. + * @param mode - Use zero to ignore m/n calculation. + * @param pre_div - Pre divisor register value. Pure pre divisor value + * related to pre_div as pre_div_pure = (pre_div + 1) / 2 */ static unsigned long -calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div) +calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 pre_div) { - if (hid_div) - rate = mult_frac(rate, 2, hid_div + 1); + if (pre_div) + rate = mult_frac(rate, 2, pre_div + 1); if (mode) rate = mult_frac(rate, m, n); @@ -171,7 +178,7 @@ static unsigned long __clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, u32 cfg) { struct clk_rcg2 *rcg = to_clk_rcg2(hw); - u32 hid_div, m = 0, n = 0, mode = 0, mask; + u32 pre_div, m = 0, n = 0, mode = 0, mask; if (rcg->mnd_width) { mask = BIT(rcg->mnd_width) - 1; @@ -186,10 +193,10 @@ __clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, u32 cfg) } mask = BIT(rcg->hid_width) - 1; - hid_div = cfg >> CFG_SRC_DIV_SHIFT; - hid_div &= mask; + pre_div = cfg >> CFG_SRC_DIV_SHIFT; + pre_div &= mask; - return calc_rate(parent_rate, m, n, mode, hid_div); + return calc_rate(parent_rate, m, n, mode, pre_div); } static unsigned long @@ -715,7 +722,7 @@ static int clk_edp_pixel_set_rate(struct clk_hw *hw, unsigned long rate, s64 src_rate = parent_rate; s64 request; u32 mask = BIT(rcg->hid_width) - 1; - u32 hid_div; + u32 pre_div; if (src_rate == 810000000) frac = frac_table_810m; @@ -731,8 +738,8 @@ static int clk_edp_pixel_set_rate(struct clk_hw *hw, unsigned long rate, continue; regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, - &hid_div); - f.pre_div = hid_div; + &pre_div); + f.pre_div = pre_div; f.pre_div >>= CFG_SRC_DIV_SHIFT; f.pre_div &= mask; f.m = frac->num; @@ -760,7 +767,7 @@ static int clk_edp_pixel_determine_rate(struct clk_hw *hw, int delta = 100000; s64 request; u32 mask = BIT(rcg->hid_width) - 1; - u32 hid_div; + u32 pre_div; int index = qcom_find_src_index(hw, rcg->parent_map, f->src); /* Force the correct parent */ @@ -781,13 +788,13 @@ static int clk_edp_pixel_determine_rate(struct clk_hw *hw, continue; regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, - &hid_div); - hid_div >>= CFG_SRC_DIV_SHIFT; - hid_div &= mask; + &pre_div); + pre_div >>= CFG_SRC_DIV_SHIFT; + pre_div &= mask; req->rate = calc_rate(req->best_parent_rate, frac->num, frac->den, - !!frac->den, hid_div); + !!frac->den, pre_div); return 0; } @@ -974,7 +981,7 @@ static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long request; int delta = 100000; u32 mask = BIT(rcg->hid_width) - 1; - u32 hid_div, cfg; + u32 pre_div, cfg; int i, num_parents = clk_hw_get_num_parents(hw); regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg); @@ -995,8 +1002,8 @@ static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate, continue; regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, - &hid_div); - f.pre_div = hid_div; + &pre_div); + f.pre_div = pre_div; f.pre_div >>= CFG_SRC_DIV_SHIFT; f.pre_div &= mask; f.m = frac->num; @@ -1564,7 +1571,7 @@ static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate, struct clk_rcg2 *rcg = to_clk_rcg2(hw); struct freq_tbl f = { 0 }; u32 mask = BIT(rcg->hid_width) - 1; - u32 hid_div, cfg; + u32 pre_div, cfg; int i, num_parents = clk_hw_get_num_parents(hw); unsigned long num, den; @@ -1576,7 +1583,7 @@ static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate, return -EINVAL; regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg); - hid_div = cfg; + pre_div = cfg; cfg &= CFG_SRC_SEL_MASK; cfg >>= CFG_SRC_SEL_SHIFT; @@ -1587,7 +1594,7 @@ static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate, } } - f.pre_div = hid_div; + f.pre_div = pre_div; f.pre_div >>= CFG_SRC_DIV_SHIFT; f.pre_div &= mask; From patchwork Fri Sep 13 15:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828251 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 821653B782; Fri, 13 Sep 2024 15:08:20 +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=1726240102; cv=none; b=S8GfAeGdA99Sd0kCCwms7O0VwZyH+dou1J7LNRZ5CfzT37i1ZbDJl4DNGM4Yx+MSePglc+cu/WavnOW6ZRHytffXJvlj8fVu2APTA/eMgGFY/X8jBNqVDEOMqGg8TRdNi8ALHl1+W27Hboq1nebgSYsyCxHeHz2Ka1R7ggngcbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240102; c=relaxed/simple; bh=yHgVDv+qlZ6l11Z1oOme3t1OLz7PLjLr8ANIj+xIB5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AWduVkOxWJnWXgGJV7aGxAIUIHYRc8xNU1L5y4qilTDjf1yBPU6L89jGwQuV6nwV5tPyvKcU4kuYi0N+p0c9qgIpPTidzxH0s/G/nF8UkdqeWe2m66GnHcxTIx2hngPcJ+GuD2Ft/HKFX6JKyiYzoLtLgCSSFUf/q+fC5EvIzgg= 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=VQTkD0s6; 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="VQTkD0s6" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c3d209db94so2587980a12.3; Fri, 13 Sep 2024 08:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240099; x=1726844899; 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=6fvI1jOCtF6Xl9dCaG3UZuMyIWSGrg53RlYI10axNPM=; b=VQTkD0s64pYSWEd3LE/NeuhYC088g/1u3T/zt9R+NiDGfylD6NKKO8/Mhgk6j70+QK A9XtBoEiqsERFiJa6NSStvfdQzguxNHJbP8aAPCdfqvBpP7TstgM1/B9pMEN+nt77V5f 2eHEZQoMEZeabp+3tOwJFMdia1LBpCS+woMGcEl4Uqk9E98B+1EPkP7Xbu9XV/hWlfIG zXaJHwL3puanGBKcNKK4HwZ8l0qW5MhPMbq5p21FPeuBULjyRaWez3+aF0jKhRZ50IQm gji9uE6/IqCPOEqjw7R9UrNkKzsOi8aiv2Gyl/ZnV4sSoGgCG4Bcd5RAHdRlVpZ2Lguo YFEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240099; x=1726844899; 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=6fvI1jOCtF6Xl9dCaG3UZuMyIWSGrg53RlYI10axNPM=; b=CPoZTb8CFflENbZLG8rH6+9iIocKz5BVtfyo4pcJjYR0P+1Nsq90pxbe0IAz9/KExp qyHB7Rma+RSTNX4YT8CsTjXCrisYdZcI5IN6PRTW6yR5X1JLs4Fkq3Y1UjKI+2HpWyIS ZSB9JOOC1bKmH/NQ2YwwadBf78BrqbSLfeR7NxSMLsxF3a7UB9MeOkd2o+i+phr+Laa4 FVgPEAZP+ylLODmkNhKfekSrW7/1+lLqtoVtau7HNk1WXLuc1LTrQVo3YWdOqw8o9AUq uaQahJ2gBLWtfvMb8s+EUYBkSdIHPZeslkiZerGKcu5SrCNbbhuOlnyk8PrKS0LsgwE+ 2sGg== X-Forwarded-Encrypted: i=1; AJvYcCUBVgHEDl09Hbnb6AwemDMGOhwNQ1wZJKix6fV6ZFHa/05J55OazJYTJm8nGHLov1//fuO9fIP4tL+So6uI@vger.kernel.org, AJvYcCUPrxQYrABWNJrfkrHyv+m7QHByXR/9l1WuDp227c+IruoExaZ2lwTIu0PaNbSpM5u1t/U6X8sI1m+c@vger.kernel.org, AJvYcCVYqUXjVL0EXGVeio+IgIIvhbZhS7rGCTg0LKd5ep8BRL1qnpTvegpU99hg3pUYugQtXx6YXWZKTe0H@vger.kernel.org, AJvYcCVgIR7CwBowMVQXNPKj+JVRA9WVw5g3FJTc6ZNGjOH1T2skzvcIUd0NEleEYVUsdEi2gb+CsedH6DV86g==@vger.kernel.org, AJvYcCVoZJ2/3/CSK9VgjGdXR2Uj2Fep8JJGSUKedMxd0BjXLKfuSZ9tifbJ9OdMLuAFIdJMm9empbMihdxF@vger.kernel.org, AJvYcCX/p/75gzViYz3Bt9PpySYoVFwI5Etr/cPaHTO8Zme5c/8a3lYFLDSWi7WnnQiw1l8LTZkDeqRbt+JBTxQ6E/qpahw=@vger.kernel.org, AJvYcCXXSo0UhhEYMSAAXvfzTi74uEImo3V/sDmZrbY+ZuwUGKQQjJs6tJWFt3P6V9xBSPvXfI8tJhvwmHM/n5Y=@vger.kernel.org, AJvYcCXwrXiVTdzde1LoSQn9LpLLtnURTwhD9yU7kvEgtwKeD4lk3vtnet8GDJiFEcXZWSYq+jWy1oNUMbfLmFV3sQ==@vger.kernel.org X-Gm-Message-State: AOJu0YydIQjUaawn0lSEnqVIo+fmo7iT6Ce0lWyyX0HFx/ycuOFOsLwP X2gMsW/wn9SvlI5kQaAPVB7M6FGyh2OKbFYMLo1G7SZikmYGFOuoodGLJw== X-Google-Smtp-Source: AGHT+IHrrXfIYz4HjX/UrLHfxg4n9InFM0pbyDYkbCAqUrOw5kODsOxMeGLYWr5NO3WVEeKXCONZfQ== X-Received: by 2002:a05:6402:5204:b0:5c3:9fa9:1b72 with SMTP id 4fb4d7f45d1cf-5c413e09477mr5257979a12.6.1726240098267; Fri, 13 Sep 2024 08:08:18 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:17 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:46 +0300 Subject: [PATCH v4 03/27] gcc-sdm845: Add general purpose clock ops Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-3-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=11498; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=yHgVDv+qlZ6l11Z1oOme3t1OLz7PLjLr8ANIj+xIB5s=; b=DCvJ81YAf9O46UqRzheehrcTwNur3mOg0JIghb5LqGFYmHsEb4j4smZqH6livH/0THjxK3IkM LzaB5BKjaTiB7s8PEeVxckl43hm2+c1y+iuN/Wvrs71ek3UBLlb5Imf X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= SDM845 has "General Purpose" clocks that can be muxed to SoC pins to clock various external devices. Those clocks may be used as e.g. PWM sources for external peripherals. GPCLK can in theory have arbitrary value depending on the use case, so the concept of frequency tables, used in rcg2 clock driver, is not efficient, because it allows only defined frequencies. Introduce clk_rcg2_gp_ops, which automatically calculate clock mnd values for arbitrary clock rate. The calculation done as follows: - upon determine rate request, we calculate m/n/pre_div as follows: - find parent(from our client's assigned-clock-parent) rate - find scaled rates by dividing rates on its greatest common divisor - assign requested scaled rate to m - factorize scaled parent rate, put multipliers to n till max value (determined by mnd_width) - validate calculated values with *_width: - if doesn't fit, delete divisor and multiplier by 2 until fit - return determined rate Limitations: - The driver doesn't select a parent clock (it may be selected by client in device tree with assigned-clocks, assigned-clock-parents properties) Signed-off-by: Dzmitry Sankouski --- drivers/clk/qcom/clk-rcg.h | 1 + drivers/clk/qcom/clk-rcg2.c | 192 ++++++++++++++++++++++++++++++++++++++++-- drivers/clk/qcom/gcc-sdm845.c | 21 ++--- 3 files changed, 193 insertions(+), 21 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h index 8e0f3372dc7a..8817d14bbda4 100644 --- a/drivers/clk/qcom/clk-rcg.h +++ b/drivers/clk/qcom/clk-rcg.h @@ -189,6 +189,7 @@ struct clk_rcg2_gfx3d { container_of(to_clk_rcg2(_hw), struct clk_rcg2_gfx3d, rcg) extern const struct clk_ops clk_rcg2_ops; +extern const struct clk_ops clk_rcg2_gp_ops; extern const struct clk_ops clk_rcg2_floor_ops; extern const struct clk_ops clk_rcg2_fm_ops; extern const struct clk_ops clk_rcg2_mux_closest_ops; diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index df491540ef39..1397cbd39bdb 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -8,11 +8,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -32,6 +34,7 @@ #define CFG_REG 0x4 #define CFG_SRC_DIV_SHIFT 0 +#define CFG_SRC_DIV_LENGTH 8 #define CFG_SRC_SEL_SHIFT 8 #define CFG_SRC_SEL_MASK (0x7 << CFG_SRC_SEL_SHIFT) #define CFG_MODE_SHIFT 12 @@ -148,6 +151,14 @@ static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index) return update_config(rcg); } +// Converts divisors to corresponding clock register values. +// @param f - Frequency table with pure m/n/pre_div parameters. +static void convert_to_reg_val(struct freq_tbl *f) +{ + f->pre_div *= 2; + f->pre_div -= 1; +} + /* * Calculate m/n:d rate * @@ -400,16 +411,116 @@ static int clk_rcg2_fm_determine_rate(struct clk_hw *hw, return _freq_tbl_fm_determine_rate(hw, rcg->freq_multi_tbl, req); } -static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f, - u32 *_cfg) +// Split multiplier that doesn't fit in n neither in pre_div. +// +// @param multiplier - multiplier to split between n and pre_div +// @param pre_div_pure - pointer to pre divisor value +// @param n - pointer to n divisor value +// @param hid_max - pre divisor maximum value +// +static inline void clk_rcg2_split_div(int multiplier, unsigned int *pre_div_pure, + u16 *n, unsigned int hid_max) +{ + *n = mult_frac(multiplier * *n, *pre_div_pure, hid_max); + *pre_div_pure = hid_max; +} + +static void clk_rcg2_calc_mnd(u64 parent_rate, u64 rate, struct freq_tbl *f, + unsigned int mnd_max, unsigned int hid_max) +{ + int i = 2, count = 0; + unsigned int pre_div_pure = 1; + unsigned long rates_gcd, scaled_parent_rate; + u16 m, n = 1, n_candidate = 1, n_max; + + rates_gcd = gcd(parent_rate, rate); + m = rate / rates_gcd; + scaled_parent_rate = parent_rate / rates_gcd; + while (scaled_parent_rate > (mnd_max + m) * hid_max) { + // we're exceeding divisor's range, trying lower scale. + if (m > 1) { + m--; + scaled_parent_rate = mult_frac(scaled_parent_rate, m, (m + 1)); + } else { + f->n = mnd_max + m; + f->pre_div = hid_max; + f->m = m; + } + } + + n_max = m + mnd_max; + + while (scaled_parent_rate > 1) { + while (scaled_parent_rate % i == 0) { + n_candidate *= i; + if (n_candidate < n_max) + n = n_candidate; + else if (pre_div_pure * i < hid_max) + pre_div_pure *= i; + else + clk_rcg2_split_div(i, &pre_div_pure, &n, hid_max); + + scaled_parent_rate /= i; + } + i++; + count++; + } + + f->m = m; + f->n = n; + f->pre_div = pre_div_pure > 1 ? pre_div_pure : 0; +} + +static int clk_rcg2_determine_gp_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + struct freq_tbl *f; + int mnd_max = BIT(rcg->mnd_width) - 1; + int hid_max = BIT(rcg->hid_width) - 1; + struct clk_hw *parent; + u64 parent_rate; + + parent = clk_hw_get_parent(hw); + parent_rate = clk_get_rate(parent->clk); + if (!parent_rate) + return -EINVAL; + + f = kzalloc(sizeof(*f), GFP_KERNEL); + + if (!f) + return -ENOMEM; + + clk_rcg2_calc_mnd(parent_rate, req->rate, f, mnd_max, hid_max / 2); + convert_to_reg_val(f); + req->rate = calc_rate(parent_rate, f->m, f->n, f->n, f->pre_div); + + kfree(f); + + return 0; +} + +static int __clk_rcg2_configure_parent(struct clk_rcg2 *rcg, u8 src, u32 *_cfg) { - u32 cfg, mask, d_val, not2d_val, n_minus_m; struct clk_hw *hw = &rcg->clkr.hw; - int ret, index = qcom_find_src_index(hw, rcg->parent_map, f->src); + u32 mask = CFG_SRC_SEL_MASK; + int index = qcom_find_src_index(hw, rcg->parent_map, src); if (index < 0) return index; + *_cfg &= ~mask; + *_cfg |= rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT; + + return 0; +} + +static int __clk_rcg2_configure_mnd(struct clk_rcg2 *rcg, const struct freq_tbl *f, + u32 *_cfg) +{ + u32 cfg, mask, d_val, not2d_val, n_minus_m; + int ret; + if (rcg->mnd_width && f->n) { mask = BIT(rcg->mnd_width) - 1; ret = regmap_update_bits(rcg->clkr.regmap, @@ -438,9 +549,8 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f, } mask = BIT(rcg->hid_width) - 1; - mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK | CFG_HW_CLK_CTRL_MASK; + mask |= CFG_MODE_MASK | CFG_HW_CLK_CTRL_MASK; cfg = f->pre_div << CFG_SRC_DIV_SHIFT; - cfg |= rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT; if (rcg->mnd_width && f->n && (f->m != f->n)) cfg |= CFG_MODE_DUAL_EDGE; if (rcg->hw_clk_ctrl) @@ -452,6 +562,22 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f, return 0; } +static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f, + u32 *_cfg) +{ + int ret; + + ret = __clk_rcg2_configure_parent(rcg, f->src, _cfg); + if (ret) + return ret; + + ret = __clk_rcg2_configure_mnd(rcg, f, _cfg); + if (ret) + return ret; + + return 0; +} + static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) { u32 cfg; @@ -472,6 +598,26 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) return update_config(rcg); } +static int clk_rcg2_configure_gp(struct clk_rcg2 *rcg, const struct freq_tbl *f) +{ + u32 cfg; + int ret; + + ret = regmap_read(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), &cfg); + if (ret) + return ret; + + ret = __clk_rcg2_configure_mnd(rcg, f, &cfg); + if (ret) + return ret; + + ret = regmap_write(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), cfg); + if (ret) + return ret; + + return update_config(rcg); +} + static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, enum freq_policy policy) { @@ -525,6 +671,28 @@ static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, return __clk_rcg2_set_rate(hw, rate, CEIL); } +static int clk_rcg2_set_gp_rate(struct clk_hw *hw, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + int mnd_max = BIT(rcg->mnd_width) - 1; + int hid_max = BIT(rcg->hid_width) - 1; + struct freq_tbl *f; + int ret; + + f = kzalloc(sizeof(*f), GFP_KERNEL); + + if (!f) + return -ENOMEM; + + clk_rcg2_calc_mnd(parent_rate, rate, f, mnd_max, hid_max / 2); + convert_to_reg_val(f); + ret = clk_rcg2_configure_gp(rcg, f); + kfree(f); + + return ret; +} + static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { @@ -652,6 +820,18 @@ const struct clk_ops clk_rcg2_ops = { }; EXPORT_SYMBOL_GPL(clk_rcg2_ops); +const struct clk_ops clk_rcg2_gp_ops = { + .is_enabled = clk_rcg2_is_enabled, + .get_parent = clk_rcg2_get_parent, + .set_parent = clk_rcg2_set_parent, + .recalc_rate = clk_rcg2_recalc_rate, + .determine_rate = clk_rcg2_determine_gp_rate, + .set_rate = clk_rcg2_set_gp_rate, + .get_duty_cycle = clk_rcg2_get_duty_cycle, + .set_duty_cycle = clk_rcg2_set_duty_cycle, +}; +EXPORT_SYMBOL_GPL(clk_rcg2_gp_ops); + const struct clk_ops clk_rcg2_floor_ops = { .is_enabled = clk_rcg2_is_enabled, .get_parent = clk_rcg2_get_parent, diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c index dc3aa7014c3e..82da8138b766 100644 --- a/drivers/clk/qcom/gcc-sdm845.c +++ b/drivers/clk/qcom/gcc-sdm845.c @@ -283,26 +283,17 @@ static struct clk_rcg2 gcc_sdm670_cpuss_rbcpr_clk_src = { }, }; -static const struct freq_tbl ftbl_gcc_gp1_clk_src[] = { - F(19200000, P_BI_TCXO, 1, 0, 0), - F(25000000, P_GPLL0_OUT_EVEN, 12, 0, 0), - F(50000000, P_GPLL0_OUT_EVEN, 6, 0, 0), - F(100000000, P_GPLL0_OUT_MAIN, 6, 0, 0), - F(200000000, P_GPLL0_OUT_MAIN, 3, 0, 0), - { } -}; - static struct clk_rcg2 gcc_gp1_clk_src = { .cmd_rcgr = 0x64004, .mnd_width = 8, .hid_width = 5, .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_gp1_clk_src, + .freq_tbl = {}, .clkr.hw.init = &(struct clk_init_data){ .name = "gcc_gp1_clk_src", .parent_data = gcc_parent_data_1, .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_gp_ops, }, }; @@ -311,12 +302,12 @@ static struct clk_rcg2 gcc_gp2_clk_src = { .mnd_width = 8, .hid_width = 5, .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_gp1_clk_src, + .freq_tbl = {}, .clkr.hw.init = &(struct clk_init_data){ .name = "gcc_gp2_clk_src", .parent_data = gcc_parent_data_1, .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_gp_ops, }, }; @@ -325,12 +316,12 @@ static struct clk_rcg2 gcc_gp3_clk_src = { .mnd_width = 8, .hid_width = 5, .parent_map = gcc_parent_map_1, - .freq_tbl = ftbl_gcc_gp1_clk_src, + .freq_tbl = {}, .clkr.hw.init = &(struct clk_init_data){ .name = "gcc_gp3_clk_src", .parent_data = gcc_parent_data_1, .num_parents = ARRAY_SIZE(gcc_parent_data_1), - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_gp_ops, }, }; From patchwork Fri Sep 13 15:07: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: 828681 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 E109B76F1B; Fri, 13 Sep 2024 15:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240104; cv=none; b=bPcd8cK3mjejrykg8NL7nSRWCG0EBOOGrSEdQ3p84icuQoAkS1g/IWmHrMc9R8XO2jApmTj5TzAl4wP2O91TVFXpDpfApQZfUu1tA6OWODFU8t+OPnpLJ2E5Wbw/7+WfgM326ZoHIvhg3807B5+V5Zg+TSz3xCXM3w3pL9RIn3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240104; c=relaxed/simple; bh=lHC11SnBOPQNkFZuoSqA2ydkUDzKzto52kps1UXs5lY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z9XKYQsa4s2a+JHweUoAPslUncQjV8HQlMcwSMiiPUfUHg0dpjAon0JI9GiGJvb59ZNUx0iTQV65AFTu+0+IjAxayVIj7bmXQGZ3v6d14HfWSdF8zLlh9nfX6wkr/2WvezWDgpqF4uaH11CtApuXsar4JmcSUiUCorfsyIszjO0= 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=mPNKMI/A; arc=none smtp.client-ip=209.85.208.181 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="mPNKMI/A" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2f74e468baeso14253591fa.2; Fri, 13 Sep 2024 08:08:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240101; x=1726844901; 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=wMPOrMm8jMnc3632xlKhYJc7ApymMUVT8Ea4A90ExoA=; b=mPNKMI/AX72ILT1VJidtCr1G+G4zJ/susofBXCeXgmSccCjdCH3jSWiyfriyBKMCsa HU0OihLmfR91dwS5LYqofp0Js6Cui/7VjI6dHb/P7rVkO9EfesXAMb61OqgWVhtap2vj kLwhGQEWiXb6ysHVb2y1hCelxgR6DWHxOl8+PR8epEnLfDHgxryK6Hxlw8Jz25uHtahT UT+UCUdy+gnQq/8Jzc9PdBr04YrLkhBRIynyJxSi5QAcgFHV1IbhwjzicxYHQDn5O3tl B7feBu3wBMOqmuveRt6/0Q/sRe4RUIu6OhGkAxlUnkMgvjZ9EnISj3y241RusmufEg/X jJ6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240101; x=1726844901; 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=wMPOrMm8jMnc3632xlKhYJc7ApymMUVT8Ea4A90ExoA=; b=CDo4CEzFNqGZfbsqlA5YelMxjHBm5qhUAGyFxN0T7FWcRz9adkaltfgu8yXMhm0a+4 rA6WTWgvAhs0FPb+10AeY1cUqq4HKsU6mLulAtwWoTPkdOfw91LeTM9gAOf5w7yLhBFK HJrrLu6HLZKxSGqIUw5yNl7jHPOBHo2cmtLzqkzgYVEAhjxTBUuN7XgllzcMbRGp5uqZ J7WshFs6Mef86/2xbLzHK/XoX9Ef3BFiqIMn2jQzIGDeH20v2fEYvQ4LMPaHE5XG+SKh vzrSH3BdM5NdJMi3emiF0xxFqpi5OtOkScg9l254n8Y7JPH6iMKBssCuow6YQ+5SFdwt 0T0g== X-Forwarded-Encrypted: i=1; AJvYcCU56thdkn2oWCufgM/EmVqYsBLqd7yMcbBUj2dEnjrsdiifYIhN4KBXvag7A0NchVXG3/0be+oQlCglda7eTA==@vger.kernel.org, AJvYcCUOivfnDfdU+olV9Yd0czXSfFyVzhl8cQSm1pMFJ/By9GjDYY0xNOTtG1Mk/A4Egvb/yfQNPkt/fOOy@vger.kernel.org, AJvYcCUf8gqPf7cTYHc/l+f9zMC/gpJudB1J1QYa7e1FxLcXJ6ADvinJDT3JRVnWuKzs89hIziyGfxySgjRV@vger.kernel.org, AJvYcCUnzLgShR2X+413qJsLwcs2SWTz/NoeRlW1wXSZOdBY5f6MnaCK29qWVI0nAu04GxeOCGThs+AXm8GBAQ==@vger.kernel.org, AJvYcCUrXfso5IY2Sjy3ik4W4Qnv9Ax/wdkA0wVh4e2nkKRnh5hQFBiTRBbGrY5ZrMko5P2dix8AtCntUw9L3gs=@vger.kernel.org, AJvYcCVBaG8g09Qf5KJjDuI+HozFMgjmYS+PSY7cjSDUBxrJl2fny5g9ru8HhoDDDwfPAYj0p7cLmpz4E/w9@vger.kernel.org, AJvYcCVuRZj3pzRQNvix917qouZahPp7C5IlDGifqJlMG16tWs/9/mwcF6FKddqOoxt9q/QfaoCrSFsdWGSJsIEt@vger.kernel.org, AJvYcCWiZLD+nflOrruCh/dH0ipU94RCsFpNp1lAEN4LM5di9rLqhwbyG8IafH8MuGV9PsN8ssUjveDL7fVspBtph6q8+bw=@vger.kernel.org X-Gm-Message-State: AOJu0YzSJ2iLE6rSO482SfcxAMr915OCUenG3r1+nU7ciNlX7CQFHxTL TMg4CJyclN2d2zYjDlV+DDa28aLq6+M+XILJnicG1H4Pov09+2KZWq9Dcw== X-Google-Smtp-Source: AGHT+IHOq0ajhiiX6/2VDkjD7OIJvbRCL5YZQQ8Umg2mhAbHCC7u57QfKrIJ12XBt8uKlJFFSVh4Dw== X-Received: by 2002:a2e:742:0:b0:2f7:58bc:f4a9 with SMTP id 38308e7fff4ca-2f791a0240dmr14340641fa.22.1726240100649; Fri, 13 Sep 2024 08:08:20 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:20 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:47 +0300 Subject: [PATCH v4 04/27] 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: <20240913-starqltechn_integration_upstream-v4-4-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=3064; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=lHC11SnBOPQNkFZuoSqA2ydkUDzKzto52kps1UXs5lY=; b=jrZn354suum7/Hl3EqQfo4nUjsVOjlJpUtGAs4oA02Z5jNsaEdnyp9+LALkOuEXzg4g+kRD6F bQbl+GqoobHDb+a4BWfUNyHCkRBfDKaSiwpo1UEHKMmNnNi444+otJO 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 --- Changes in v4: - change dts example intendation from tabs to spaces - remove reset-gpios description --- .../bindings/display/panel/samsung,s6e3ha8.yaml | 75 ++++++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 80 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..94c812e07571 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/samsung,s6e3ha8.yaml @@ -0,0 +1,75 @@ +# 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: true + + 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 52b72d212c18..b65cfa1d322d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7381,6 +7381,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 Fri Sep 13 15:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828250 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 3DA217A15A; Fri, 13 Sep 2024 15:08:25 +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=1726240107; cv=none; b=WroV9e1L9t9x1ijreDSFpsVlB6t3t9cCsqXrIJMAxuNX65Pp8iPGi33Lojum7lc+Izs2lIyQP8ftXyuv7VwMUTtSVHJmu0hh+VvDMJbY3BJxNbxWBwdoqUTpUEfaHEjGIZEMg9QVLiEfdoBprT6UHF8AS2RRcBcRcLO41NXpUQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240107; c=relaxed/simple; bh=5BxvSoJGkTvuZWFT0LW8xSppfKPLK5W8Ozr1yp+nxb0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eUA19e2h5wF+PUobkKugKZCQkzLSUH4Szo05LYFKf7JqSeP0Ige3yIKEpT3OujO1L6PKipguxbrHgA1tDL1lwC9kYz+HCOTyBGssBzo7FoCMUay+UsI5U9+BXP27TeZ/6J2Cv4Vyl1EdNmO4YpKYOuwDpjjOOlfhAnWv+zn65iI= 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=U6RFea03; 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="U6RFea03" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5c25554ec1eso2652020a12.1; Fri, 13 Sep 2024 08:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240103; x=1726844903; 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=6qs9D7WYZmFir3ENOGTcz3S245/jkLwimxjEHB73n2I=; b=U6RFea038wtTPIpUxm9qNE+vPXzXjou+6YOsXAMMGBpUwyYql3ljtiUItlrgaqWLrg UK0gdzmk3GXPr70O8kDiEpPzFbynhhhdwXh0BDLexceQUgS5fy5z/Lg/HVdUk//821+8 0qpEy5m0cGVfLFDOmlULObPz/nvQBlgvjifbJWI66h1rsg92onqEuxLHC9fxp5FpYSmF 0FF/sCVvT3HksrBfTyHPelTOUeFKmG74V+Vj+mOX+oOwPnP6/0ACmT7zWOoxMQYBo95z GTu/xLQ5hBPD36lzhadbRnK7IJC9EvMkMl6VmxgwQZgu2tEYkghQWdm+5wckNC78CW9l 5qgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240103; x=1726844903; 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=6qs9D7WYZmFir3ENOGTcz3S245/jkLwimxjEHB73n2I=; b=QGaqCb3vB3vaKnNxlYZJ7PpwnU7sKB6fu5DiMkgYkbzVOxMo7lZKuOUYXJ35cLwBd4 Q8Vmhjz862C5P+1twbZpR6VhErx4GGqXW6Ljk8KmwSJfbqiJm/BO5m2mYSQUGUmCkV1q BuYZKAGeRscIjaWadmCM3Pnpu3RHWARxOSQuDoImj61Qh+zwN5UNna0URJjJVVBFhktn TP75rvzKfM7AGL94dUFZJRAXfQRQsrLa9RjwNgcK3FiQWIVRwMIlM8ggn1+3mZ3rtzyl p6v6/aj65lZpETD5oF4wxf7PTpe4SrlttpmX4lQv/uDKoFe8ML34b+mvphsfUdIkx1qT 52+A== X-Forwarded-Encrypted: i=1; AJvYcCUCpluUl5Esj2uqQx2/l33xl677rcykp0osHRwMNswEcQS7UQvY0zA8bO/s17MK3VXXJhLt0/LyFLt0@vger.kernel.org, AJvYcCUDbFqLyh/BnUxnP7/0B1qfESPfiVIRG+64X4XNX7crRsjk5uHG/VjfrUv96Zj2D637qMSUjcoDtKAtDjmk@vger.kernel.org, AJvYcCUo65Oc82arC0Q1e7oYQESJu8wvQIOffp0+n8JSlPWp7uJkPyMqTduw+VTFm5qCnS5VBvYDOc3oApVw@vger.kernel.org, AJvYcCVuV6eqCm1FxpRkKkB9iKddRRy/daTMpbvIZlHu9qEPVbdGXs84jhqq6c4mGicafy3dn/+hptYEfmmgI2jrFQDlYZc=@vger.kernel.org, AJvYcCWUzxPlv2GjCNE0uWT0/rJ1lsrwzMFxjPGUduVbcMfNK8n/ttjqfBWTEZfqwkqcp4S0QvTAxqglwF1uNw==@vger.kernel.org, AJvYcCWeJw+3WDMtg5RllBZj3hI+2BSGRDLgUMBvxPDTwLgZZKFr0yHonMc+8/ioBq1fFbfjxO0ZA2Al8okzKIQ=@vger.kernel.org, AJvYcCWqtDxmtMnRRtoT8bI+xFiUOFviQnw9ecMuLLf0+h0cqRWaTjY+wC0JnaY6WC/jwUA72j8r/dbKh93DZwvRMA==@vger.kernel.org, AJvYcCXPExuge/pv3yct4RUhEfWoY59Cxc5dUzZJVt3m0yOHBVsVPdVbGhH5efcKivb6m4JAmqChyBADLT2k@vger.kernel.org X-Gm-Message-State: AOJu0Yw3n2kuTnFoXMYj4l17ikt8oBQ5Hzioq/IehAiPRTxn9kw5ZMOC c+kiyTgVf9GceG7e6vacr2gB9cTNNa+rm++hfN3qhFSUIr63E9O4TIFxTg== X-Google-Smtp-Source: AGHT+IGahGtGigZva5WPUaLkeCtIA6xLZrMdXSHJDxtijqoIvYyvOjyZWfSktvVNDMinjY/pES1pWw== X-Received: by 2002:a05:6402:2108:b0:5c4:2396:d990 with SMTP id 4fb4d7f45d1cf-5c42396da70mr1184642a12.17.1726240103019; Fri, 13 Sep 2024 08:08:23 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:22 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:48 +0300 Subject: [PATCH v4 05/27] dt-bindings: mfd: 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: <20240913-starqltechn_integration_upstream-v4-5-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=5568; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=5BxvSoJGkTvuZWFT0LW8xSppfKPLK5W8Ozr1yp+nxb0=; b=hFCvbe7/NZeyGGOlUrY6moZjqhp7M+tq8u1pB+8hJ/1RUhTji/N5Cbrm4vhl7h0G8elBiXQzQ QfaTXcE8qh7CEAMHTuEUJaLdsG2uiUE6446V2gdDN4K4dbzfSIKDgrv X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add maxim,max77705 core binding part. Signed-off-by: Dzmitry Sankouski --- Changes in v4: - change dts example intendation from tabs to spaces - remove interrupt-names property - remove obvious reg description - split long(>80) lines --- .../devicetree/bindings/mfd/maxim,max77705.yaml | 169 +++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 170 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/maxim,max77705.yaml b/Documentation/devicetree/bindings/mfd/maxim,max77705.yaml new file mode 100644 index 000000000000..40a67d15e312 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/maxim,max77705.yaml @@ -0,0 +1,169 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/maxim,max77705.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Maxim MAX77705 Companion Power Management IC and USB Type-C interface IC + +maintainers: + - Dzmitry Sankouski + +description: | + This is a part of device tree bindings for Maxim MAX77705 multi functional + device. + + The Maxim MAX77705 is a Companion Power Management and Type-C + interface IC which includes charger, fuelgauge, LED, haptic motor driver and + Type-C management IC. + +properties: + compatible: + const: maxim,max77705 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + charger: + $ref: /schemas/power/supply/power-supply.yaml + additionalProperties: true + properties: + compatible: + const: maxim,max77705-charger + + required: + - compatible + - monitored-battery + + fuel_gauge: + $ref: /schemas/power/supply/power-supply.yaml + type: object + additionalProperties: true + description: MAX77705 fuel gauge with ModelGauge m5 EZ algorithm support. + properties: + compatible: + const: maxim,max77705-fuel-gauge + + shunt-resistor-micro-ohms: + description: | + The value of current sense resistor in microohms. + + required: + - compatible + - shunt-resistor-micro-ohms + - monitored-battery + - power-supplies + + haptic: + type: object + additionalProperties: false + properties: + compatible: + const: maxim,max77705-haptic + + haptic-supply: true + + pwms: + maxItems: 1 + + required: + - compatible + - haptic-supply + - pwms + + leds: + type: object + additionalProperties: false + description: + Up to 4 LEDs supported. One LED is represented by one child node. + properties: + compatible: + const: maxim,max77705-led + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + patternProperties: + "^led@[0-3]$": + type: object + $ref: /schemas/leds/common.yaml# + properties: + reg: + description: + LED index. + unevaluatedProperties: false + required: + - reg + + required: + - compatible + +required: + - compatible + +additionalProperties: false + +examples: + - | + #include + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@66 { + compatible = "maxim,max77705"; + reg = <0x66>; + interrupt-parent = <&pm8998_gpios>; + interrupts = <11 IRQ_TYPE_LEVEL_LOW>; + 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>; + }; + + fuel_gauge { + compatible = "maxim,max77705-fuel-gauge"; + monitored-battery = <&battery>; + power-supplies = <&max77705_charger>; + rsense = <5>; + }; + + + haptic { + compatible = "maxim,max77705-haptic"; + haptic-supply = <&vib_regulator>; + pwms = <&vib_pwm 0 50000>; + }; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index b65cfa1d322d..59d027591e34 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14064,6 +14064,7 @@ B: mailto:linux-samsung-soc@vger.kernel.org F: Documentation/devicetree/bindings/*/maxim,max14577.yaml F: Documentation/devicetree/bindings/*/maxim,max77686.yaml F: Documentation/devicetree/bindings/*/maxim,max77693.yaml +F: Documentation/devicetree/bindings/*/maxim,max77705*.yaml F: Documentation/devicetree/bindings/*/maxim,max77843.yaml F: Documentation/devicetree/bindings/clock/maxim,max77686.txt F: drivers/*/*max77843.c From patchwork Fri Sep 13 15:07: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: 828680 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 7432E8121F; Fri, 13 Sep 2024 15:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240109; cv=none; b=ivxNY584J6iVS94LK0quhliayUwH0RlaaLCO3rCbyGy3jvNV60YeQuDankNM5pWMs/pm9BPG6oJvmtGV7D60aWX+TPONHcteY0O5qnhncGO/J04mwgFSLdlJW7SjkfeOcGcsgWmOO3/Hplm/Tnyet5SGW3mJTf0xflIbxeTLZaI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240109; c=relaxed/simple; bh=o6dr1Wo9Wqt+cqjXIx9vp714Hl+GKINdhrfYqTXSHMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IcWMYy1PPgk+LKGVaUEqEGTkJqVSkpz5DYmoW2r53h8/HZ5abXsDqoI9EmdXqbM/h6aeyOD1Dh7c9K+k9kv7TGhz/wauhuXfLOcWINEZdO5OP9zidYDfbONMu1r+C9zLvQdS8UkAAebpB9s6Ujc8V0kJ8vYoiUqSz2ObB54X6VA= 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=Qa/Utu9q; arc=none smtp.client-ip=209.85.208.175 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="Qa/Utu9q" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2f75de9a503so25909711fa.0; Fri, 13 Sep 2024 08:08:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240105; x=1726844905; 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=+edNV2wnMqv6Fg14CUmntzU2d84+FrbyEUaBI7DKpMo=; b=Qa/Utu9qDGPfbzzQLPyLS1GzrZZd/eH+fp820xgciQURlbAsynZ0cSvLFDo5+BhleI lLvn2HYa3ksTy9liJf7HjIb86GNAqfIMI4MIiHGGTXiSyG/XCd4SSNnaPKQWVRpDSG1r BjHszLXuKS5En/4ygNObEaXORkfbyzPXzJK52bJnY1zS0GKwIqPR+MflqOZLqf22vRpx z2YYSAGY27TxSDPRL3lQCFHaeEzPDGbDktKlINj1XygLutsj2p+8UwLmCcbkeBUqItZ6 MUSDFOsW3lJ7YDc2buPS03g4/VK1pHMkBxyLRi0OmA8VKi+14YWQag5/goew4hpOSPpF HP7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240105; x=1726844905; 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=+edNV2wnMqv6Fg14CUmntzU2d84+FrbyEUaBI7DKpMo=; b=TlMElOkEtCGmaCS7z3GRuT0WvvDbNDM3SKWdlg6LItvUlCKzd3mazxGEfTQDNhRn3z Of1ARtjoBbEQIf/698Xeu1HXq6cD9z6j5Rl1GVoyYUDghOHb5x9ZbABFqn2xfILq+BYV bAgiGYXqGG3ajqcQcRYgtoO80LcR5cbNObJ0xTvNZpiyVHaKhgLmLTuwgPMxpkQMi2Zh AFyLTTh1t1RMLiKwRlUsnDzmPXZC4uLTgtpzv+IEG0/ttbStbqU0Qo4Cdlj/pRxMD1FR RLPyCbhUCkA7tg0ktl56Qa+P6pzlo2CWwYjzG6e8vgg5Nzt5LLXp3rzWUtyxJSzmDro5 cPjg== X-Forwarded-Encrypted: i=1; AJvYcCU9NE4kYNuH7BEAAuFhv/C1bgHs8edaQ9CC808dboGTbRV8c2EHB2bUatkpKBl7AkgbYTHlP4LVh5NqIedv@vger.kernel.org, AJvYcCUlTg87nUxRC22MxxpzamVZbAk6svACN3Q80acZM17jr5nCh/5eVtJ0z1gKGp6iYfJS06JYRAVmxrE2QMQ=@vger.kernel.org, AJvYcCVIndEIVxtxtFUGdRH+Ikb7so7rCjLSAWGVxzMRzOSKKQEAYcdg3Fon+v8reEkxEy8rR9+KJNN5dLejiA==@vger.kernel.org, AJvYcCW5YIzqbf8UGgLe9dqThyZ2jYq7WreVTAoB/glQ2PhBt2yL0Wg0kIIIgAewbXD8EN1zCu+HDdi/A+NJ6YZC8sqMoPg=@vger.kernel.org, AJvYcCWQq5iGExCdI3XdmJKi4OGc12+OMQsRIwtvyVgx3uOQDo2yqo67yS678NcUSXOnhAgSHjOE/MaLsGUd@vger.kernel.org, AJvYcCWzJDg/kHBKo7gwmwa9+s/UsbJr7zMueEKdaryyX19P449rQDBC8/mY/OKIniDPLVocQIpLIbEv9Thw@vger.kernel.org, AJvYcCXTqylcSPT+frQ59VM4nrWvpbH1puBtkpSspep+JTcgWbjlqOsapTsC+uj9zpFX5+Ntj6RE4VFDe6Mv@vger.kernel.org, AJvYcCXiPiIJqjwVo5ZrkHFlRr42OwMuf0H6v4UtolADdHileXsRLU7hnVmjdUcGgdgS/xkXQDzE8KKKipyJiYjrsQ==@vger.kernel.org X-Gm-Message-State: AOJu0YzwJrukqCUDuyhOSvmQweAaBOPHtbuzQkreFG4ib5V0uWudX4qQ oAAO0py8woCYIr/XO4gf4eDjQvxtt4G4GDpwxewtr5UV8gjoi5MfPlPRDw== X-Google-Smtp-Source: AGHT+IHJOpfVbc6BYoC9nxodPjUjSuvVPJgxKnP5qJAz/k4ls2c3ki4U+1IXN1TI74WxFMntTOIIqg== X-Received: by 2002:a05:651c:199e:b0:2ef:20ae:d113 with SMTP id 38308e7fff4ca-2f787f576a1mr45655381fa.40.1726240105287; Fri, 13 Sep 2024 08:08:25 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:25 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:49 +0300 Subject: [PATCH v4 06/27] 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: <20240913-starqltechn_integration_upstream-v4-6-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=4210; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=o6dr1Wo9Wqt+cqjXIx9vp714Hl+GKINdhrfYqTXSHMA=; b=ESIv0Ef7vJug1EWhzW4zYha8Jn3CIRqEafH3ehASUYvcOs4iTAniGnkuPXv4sfkLu+26qeFO9 Gf09Xk2+ldLCch9wTgtTHevbF4LCFvNWhakoDZ1ika/3N66fQKyru5F X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add samsung,s2dos05 MFD module binding. Signed-off-by: Dzmitry Sankouski --- Changes in v4: - split long(>80) lines - fix indentation - merge with regulators binding - drop pmic suffix - drop unused labels in example - correct description --- .../devicetree/bindings/mfd/samsung,s2dos05.yaml | 99 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 100 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..534434002045 --- /dev/null +++ b/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml @@ -0,0 +1,99 @@ +# 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 device tree bindings for S2DOS family of Power Management IC (PMIC). + + The S2DOS05 is a companion power management IC for the panel and touchscreen + in smart phones. Provides voltage regulators and + ADC for power/current measurements. + + Regulator section has 4 LDO and 1 BUCK regulators and also + provides ELVDD, ELVSS, AVDD lines. + +properties: + compatible: + const: samsung,s2dos05 + + reg: + maxItems: 1 + + regulators: + patternProperties: + "^buck1|ldo[1-4]$": + type: object + $ref: /schemas/regulator/regulator.yaml# + unevaluatedProperties: false + + required: + - regulator-name + + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@60 { + compatible = "samsung,s2dos05"; + reg = <0x60>; + + regulators { + ldo1 { + regulator-name = "s2dos05-ldo1"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <2000000>; + regulator-active-discharge = <0x1>; + }; + + ldo2 { + regulator-name = "s2dos05-ldo2"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-active-discharge = <0x1>; + regulator-boot-on; + }; + + ldo3 { + regulator-name = "s2dos05-ldo3"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-active-discharge = <0x1>; + regulator-boot-on; + }; + + ldo4 { + regulator-name = "s2dos05-ldo4"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3775000>; + regulator-active-discharge = <0x1>; + }; + + buck1 { + regulator-name = "s2dos05-buck1"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <2100000>; + regulator-active-discharge = <0x1>; + }; + }; + }; + }; + +... diff --git a/MAINTAINERS b/MAINTAINERS index 59d027591e34..92135252264a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20465,6 +20465,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 Fri Sep 13 15:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828249 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.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 B57DC84D25; Fri, 13 Sep 2024 15:08:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240115; cv=none; b=miDYzmwvqujydIfC7Q/guDCFrWzIBmOrU4V7TTAR+2GFeCnnvqhmPKT/8Rb5Ch2dee8rs6qXXM3X/ZzagusKsboQI1SpwPh7Dd7qafs3iXiotXOoY+SsoaQSx3M297k2ddRm08+aK4BbpoOdgpP6ww08X1OO9LU6oycGO14Qcyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240115; c=relaxed/simple; bh=6bnUnN2fjqbjQHrlo2uvWKZSiDrU+DiVQwIgC/N9EP4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O8sqIQ9tvwOJtKD9GiLFZmDURitbit405ZVHoEtGZE8aFUBV6aoRnaz/6+99BV1tcFxWvtZgPYWk7TMmX9Pvd9tXuOoFrrYXqiw04Up3XwXMkpxDrAe3QEXazviz8AUNO1z0ooxGgrr2GSfao/5CTI2GK0qHcjGKLGuGDb8NzrY= 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=Y6Xs0gXA; arc=none smtp.client-ip=209.85.218.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="Y6Xs0gXA" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a8a837cec81so56832866b.2; Fri, 13 Sep 2024 08:08:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240110; x=1726844910; 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=QIGDGMW2gV7nFgzFY99SH3Qqk1xbwMk6ylQkR/yKW3M=; b=Y6Xs0gXA0S3rSU1lk35UQjiysk+2lpXHdVHYM9Pk9pc58PiZs4X0wCzU8zRUK/PUMi BkSB8SjPcUsjwhJIWwhXwVd/bGZXigtcP47kAiRRQb8tdkXUQeZ12eeqtDKUlnWLgX7G O17bHbPqujmNDTwiVAQgA15JVzyKOjuAYLElIPjg3kjbM9fximI4lmvPcN1yfPEc/zr3 cM2qsGXn6TxB7dcxK758YG18yMqpmeZsA0+BnRD70WGIWQ1Lo23URaPL6GR+2PQFNDMN t1aoIU4Yg2pkTpanYb0a+ZzCQUCK1vhtpB/t0HRtOMgfJRxnSrxc5M6wqk7lbmGmJVWx 4mcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240110; x=1726844910; 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=QIGDGMW2gV7nFgzFY99SH3Qqk1xbwMk6ylQkR/yKW3M=; b=TYdm0ht1yU1VpxLf9KvX/W7MgLN60/L+UI1XRop9yaX8YeFhuOTAVwv1bZeUjoLlCG FT7Dn8w5+mu3Nej8WShonm+Xp8LzNPtYYSNDxX1j5LoNTikokpAl0RCuTIQy7uCxzPiu D3Cr4b+lbNmTUXkw4Pey2uiqIBQzPLNevf+B1tEOXGK3wBslYXn1SmKY48vyN8rZgTfM SgtqLDSEthngi2/hhTOsejXj2rLKw+p8+9FyffnfXQJCM3UPFA3l3/+v6Q3tKic6QLXk o9uQAdVObdhzK8pjS+wX6q5orgF9+uWyDA8WhHhqiAeH/NICDSImP3mmqs1p34L+9jDU Xvsw== X-Forwarded-Encrypted: i=1; AJvYcCVEsDMxC0xErrzZJJbt58YzlvSZVrWD5l4jpIwU0SduyRjx8ft5Ada5PVj8X5A7FLBL8cLrv85kENz8eYU=@vger.kernel.org, AJvYcCVewab+GPPdGoI7y73ka98kClUVxZ/GTOsgEtlJCARqM6nEq4kOq3IxyHYePHYyxg9zwbFTHPpXa4SqeAKkCkQ4uko=@vger.kernel.org, AJvYcCVrDqMEkGT6YVuqbqoRqLHDDK9AVd0N+zVedQZdxL+pcnnKOrySBAK8/c13h9imyOXqKgHZP0tidI22S47++A==@vger.kernel.org, AJvYcCWXge/th7DE6EA/85pzwxmGXQzZIxpn2bOE2qWBbLpL0AMSca0ZHJrb6/wTdYXVzEAT4QWMVh6FSn6e@vger.kernel.org, AJvYcCXK3zsZTbbnPv6cr9q5HhyfvQ7wXXSUaQ4x4mezbIp7GpVWqXMiYYSVyvzGj6pzx8UaHGLJQo5Tn87lHQ==@vger.kernel.org, AJvYcCXlBbuu/4DA4QIXDsGfDNFeQ2HCDaWZfY+IYyEenhsIpj1OQxzJQJ+1BuI+o7NHXPcHRE4CHg/aCp3Z@vger.kernel.org, AJvYcCXoymf8o0seYn6FK+1+y7d19ko8CO4APeEocV0pcajWaQdwep0XQo2f54c9P/NSjiKDUAtJqmnDSSe3@vger.kernel.org, AJvYcCXyjwNVgRyga/CUBbrlD7N/+jIT3EGrs2SgGhzUAz/dl0/I6QBDeml/dFXMiLP2YwF0wwewArgj0htDxvEr@vger.kernel.org X-Gm-Message-State: AOJu0YxETjZUDMCSOOXz79ElRWGhYTTJ8uQIuSxmg2wJtEMxRI6EmZnu vcwu1rFXfOacQ9F0RI0VtlX+s+5F/1dyxFeFUXtTugOV4ENBArXwVeF3eg== X-Google-Smtp-Source: AGHT+IHRjTy9SjhA50SvwZIPFaLCaWiSjrjxv0c+LROAPsqJ6y+hjHvz4rJM3p62I3MY9mHr/MrHFg== X-Received: by 2002:a05:6402:2551:b0:5c2:6d13:c583 with SMTP id 4fb4d7f45d1cf-5c41e1b5354mr2952918a12.28.1726240109559; Fri, 13 Sep 2024 08:08:29 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:28 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:50 +0300 Subject: [PATCH v4 07/27] 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: <20240913-starqltechn_integration_upstream-v4-7-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=14348; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=6bnUnN2fjqbjQHrlo2uvWKZSiDrU+DiVQwIgC/N9EP4=; b=w2p2aGFyl/zOnE3M+Z/e2o8rBr01lm95qewF0CbbCQ/D/TjYUjivbXqHPOq3+a5o7xU89T8al ySh2IjbpAazBcAo1mf9HrpHFa27LL2o89jv6H3q1+nth5UmE7UuRusz 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 Changes in v4: - inline power related functions - rework driver using new mipi_dsi_dcs_write_seq_multi macro - use drm_connector_helper_get_modes_fixed for modes - remove excessive compression setting --- MAINTAINERS | 1 + drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c | 350 ++++++++++++++++++++++++++ 4 files changed, 359 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 92135252264a..65cb2511ba22 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7385,6 +7385,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 d3a9a9fafe4e..65fb3a466e39 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -689,6 +689,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 987a08702410..8ee28f5a2213 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -70,6 +70,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..e69943f0527e --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e3ha8.c @@ -0,0 +1,350 @@ +// 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_test_key_on_lvl2(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0xf0, 0x5a, 0x5a) +#define s6e3ha8_test_key_off_lvl2(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0xf0, 0xa5, 0xa5) +#define s6e3ha8_test_key_on_lvl3(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0xfc, 0x5a, 0x5a) +#define s6e3ha8_test_key_off_lvl3(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0xfc, 0xa5, 0xa5) +#define s6e3ha8_test_key_on_lvl1(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0x9f, 0xa5, 0xa5) +#define s6e3ha8_test_key_off_lvl1(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0x9f, 0x5a, 0x5a) +#define s6e3ha8_afc_off(ctx) \ + mipi_dsi_dcs_write_seq_multi(ctx, 0xe2, 0x00, 0x00) + +static void s6e3ha8_amb577px01_wqhd_reset(struct s6e3ha8 *priv) +{ + gpiod_set_value_cansleep(priv->reset_gpio, 1); + usleep_range(5000, 6000); + gpiod_set_value_cansleep(priv->reset_gpio, 0); + usleep_range(5000, 6000); + gpiod_set_value_cansleep(priv->reset_gpio, 1); + usleep_range(5000, 6000); +} + +static int s6e3ha8_amb577px01_wqhd_on(struct s6e3ha8 *priv) +{ + struct mipi_dsi_device *dsi = priv->dsi; + struct device *dev = &dsi->dev; + struct mipi_dsi_multi_context ctx = { .dsi = dsi }; + int ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + s6e3ha8_test_key_on_lvl1(&ctx); + s6e3ha8_test_key_on_lvl2(&ctx); + + 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(&ctx); + + 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(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x13); + s6e3ha8_test_key_off_lvl2(&ctx); + + usleep_range(10000, 11000); + + s6e3ha8_test_key_on_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x13); + s6e3ha8_test_key_off_lvl2(&ctx); + + /* OMOK setting 1 (Initial setting) - Scaler Latch Setting Guide */ + s6e3ha8_test_key_on_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x07); + /* latch setting 1 : Scaler on/off & address setting & PPS setting -> Image update latch */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x3c, 0x10); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x0b); + /* latch setting 2 : Ratio change mode -> Image update latch */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf2, 0x30); + /* OMOK setting 2 - Seamless setting guide : WQHD */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2a, 0x00, 0x00, 0x05, 0x9f); /* CASET */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0x2b, 0x00, 0x00, 0x0b, 0x8f); /* PASET */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0xba, 0x01); /* scaler setup : scaler off */ + s6e3ha8_test_key_off_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0x35, 0x00); /* TE Vsync ON */ + s6e3ha8_test_key_on_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xed, 0x4c); /* ERR_FG */ + s6e3ha8_test_key_off_lvl2(&ctx); + s6e3ha8_test_key_on_lvl3(&ctx); + /* FFC Setting 897.6Mbps */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0xc5, 0x0d, 0x10, 0xb4, 0x3e, 0x01); + s6e3ha8_test_key_off_lvl3(&ctx); + s6e3ha8_test_key_on_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb9, + 0x00, 0xb0, 0x81, 0x09, 0x00, 0x00, 0x00, + 0x11, 0x03); /* TSP HSYNC Setting */ + s6e3ha8_test_key_off_lvl2(&ctx); + s6e3ha8_test_key_on_lvl2(&ctx); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xb0, 0x03); + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf6, 0x43); + s6e3ha8_test_key_off_lvl2(&ctx); + s6e3ha8_test_key_on_lvl2(&ctx); + /* Brightness condition set */ + mipi_dsi_dcs_write_seq_multi(&ctx, 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_dcs_write_seq_multi(&ctx, 0xb1, 0x00, 0x0c); /* AID Set : 0% */ + mipi_dsi_dcs_write_seq_multi(&ctx, 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_dcs_write_seq_multi(&ctx, 0xf4, 0xeb, 0x28); /* VINT */ + mipi_dsi_dcs_write_seq_multi(&ctx, 0xf7, 0x03); /* Gamma, LTPS(AID) update */ + s6e3ha8_test_key_off_lvl2(&ctx); + s6e3ha8_test_key_off_lvl1(&ctx); + + return 0; +} + +static int s6e3ha8_enable(struct drm_panel *panel) +{ + struct s6e3ha8 *priv = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = priv->dsi; + struct mipi_dsi_multi_context ctx = { .dsi = dsi }; + + s6e3ha8_test_key_on_lvl1(&ctx); + ctx.accum_err = mipi_dsi_dcs_set_display_on(dsi); + s6e3ha8_test_key_off_lvl1(&ctx); + + return ctx.accum_err; +} + +static int s6e3ha8_disable(struct drm_panel *panel) +{ + struct s6e3ha8 *priv = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = priv->dsi; + struct mipi_dsi_multi_context ctx = { .dsi = dsi }; + + s6e3ha8_test_key_on_lvl1(&ctx); + ctx.accum_err = mipi_dsi_dcs_set_display_off(dsi); + s6e3ha8_test_key_off_lvl1(&ctx); + msleep(20); + + s6e3ha8_test_key_on_lvl2(&ctx); + s6e3ha8_afc_off(&ctx); + s6e3ha8_test_key_off_lvl2(&ctx); + + msleep(160); + + return 0; +} + +static int s6e3ha8_amb577px01_wqhd_prepare(struct drm_panel *panel) +{ + struct s6e3ha8 *priv = to_s6e3ha8_amb577px01_wqhd(panel); + struct mipi_dsi_device *dsi = priv->dsi; + struct device *dev = &dsi->dev; + struct mipi_dsi_multi_context ctx = { .dsi = dsi }; + struct drm_dsc_picture_parameter_set pps; + int ret; + + ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); + if (ret < 0) + return ret; + msleep(120); + s6e3ha8_amb577px01_wqhd_reset(priv); + ret = s6e3ha8_amb577px01_wqhd_on(priv); + + if (ret < 0) { + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(priv->reset_gpio, 1); + goto err; + } + + drm_dsc_pps_payload_pack(&pps, &priv->dsc); + + s6e3ha8_test_key_on_lvl1(&ctx); + ret = mipi_dsi_picture_parameter_set(priv->dsi, &pps); + if (ret < 0) { + dev_err(panel->dev, "failed to transmit PPS: %d\n", ret); + return ret; + } + s6e3ha8_test_key_off_lvl1(&ctx); + + msleep(28); + + return 0; +err: + regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); + return ret; +} + +static int s6e3ha8_amb577px01_wqhd_unprepare(struct drm_panel *panel) +{ + struct s6e3ha8 *priv = to_s6e3ha8_amb577px01_wqhd(panel); + + return regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); +} + +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) +{ + return drm_connector_helper_get_modes_fixed(connector, &s6e3ha8_amb577px01_wqhd_mode); +} + +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 *priv; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->supplies[0].supply = "vdd3"; + priv->supplies[1].supply = "vci"; + priv->supplies[2].supply = "vddr"; + + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies), + priv->supplies); + if (ret < 0) { + dev_err(dev, "failed to get regulators: %d\n", ret); + return ret; + } + + priv->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(priv->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(priv->reset_gpio), + "Failed to get reset-gpios\n"); + + priv->dsi = dsi; + mipi_dsi_set_drvdata(dsi, priv); + + 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(&priv->panel, dev, &s6e3ha8_amb577px01_wqhd_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + priv->panel.prepare_prev_first = true; + + drm_panel_add(&priv->panel); + + /* This panel only supports DSC; unconditionally enable it */ + dsi->dsc = &priv->dsc; + + priv->dsc.dsc_version_major = 1; + priv->dsc.dsc_version_minor = 1; + + priv->dsc.slice_height = 40; + priv->dsc.slice_width = 720; + WARN_ON(1440 % priv->dsc.slice_width); + priv->dsc.slice_count = 1440 / priv->dsc.slice_width; + priv->dsc.bits_per_component = 8; + priv->dsc.bits_per_pixel = 8 << 4; /* 4 fractional bits */ + priv->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(&priv->panel); + return ret; + } + + return 0; +} + +static void s6e3ha8_amb577px01_wqhd_remove(struct mipi_dsi_device *dsi) +{ + struct s6e3ha8 *priv = 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(&priv->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 Fri Sep 13 15:07: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: 828679 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 7607884DE4; Fri, 13 Sep 2024 15:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240116; cv=none; b=nhQUNifZK6BqInlAwToHRQMjg+jKgBqv7YUvDLe76V6vxYIVVMJg0kvK/Jem5YjZQBZq5U8AFVD0EOJ//I+6E5ENmKURxVtbmuX7QxTBgQ5sIVQaXwhpKvC/pzYctXtBa79yFxH3TZApK5kfXjXEv8cBUFeF36scPge9BqEdftw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240116; c=relaxed/simple; bh=Q8zEcsu3xOThAfReNawr2bCrmNcwrVa7H+TfC8M0RIc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UdH0YlO1tA6Fp77F6bXCghPRPX64EfZdfwHWMIYXePlyQNF2gGSv44wmFaGZycLWaf/WagyifegbR5WnmbvJk+n11aulC7iq3rTVNyquooj4FfBzBg1ufC7UzkOzQQZwMbBdlSHxbaYF1MszzRC0rrXSH37H6RPErqydfqKhJU4= 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=LmA1atxO; arc=none smtp.client-ip=209.85.167.47 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="LmA1atxO" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5366fd6fdf1so3118172e87.0; Fri, 13 Sep 2024 08:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240112; x=1726844912; 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=8BuVtWnpggbksGVD/tDL66cKkJqocyp8CAEvr9d7e9Y=; b=LmA1atxO2uRloFl68OcBhojTxuq2YW9jCr9kx+0MC9KTqEzaWWsxoF7Tqby05r5x2A +7miC4+9zYOD0GsgX/p/LVvNzdf5YwJVB6Itwtgmxf9erauMc4QAeqc2OQuHs5qgvmzh vh33jEE+yaO7uVpxeh9MNoJEYdvSIY5MdJKRIhmNjWw6dHtOxNUu1oY3C0CcUZFMZImY 4tSN9eG4bdzPrJUc3ES5xYHFDAw551wIjLgcQxO9XieahJy+gE+F1dtKIZbKjiUiXT6N Vi+5dSvjlPYi8Qk5dYSPRFs/thwdsTykSopFhue6QozcgaKJempZp35haqFydmHC6JiD iFxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240112; x=1726844912; 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=8BuVtWnpggbksGVD/tDL66cKkJqocyp8CAEvr9d7e9Y=; b=id1DugXBFXrbOqHOMnmEiSHb4z9VoY5075fxuZOLmuXn9dRZfZAKu1RMB0DqNzhnLV dZ9ueBuZJpLNHEtTMYfjGO97tqWdXXFtTcRTu2IuamcJ36+q/UgQoGjRpPQxWfBJxRS8 3hR/BsAH54lHO72oS1W98pdq+oltXdyHLk8rypCKcbhR+bzUYj6FQ9BCGxmFQ+55jYqV VIh7aIZFYtCGeF4VffGAA6o5U5CLPAir2V3pGENFf4OikL0qQ4iN5vzu4Cn388y/Gj83 +ccGUF4Lglk4jjAWN4CUrstUzT3wOYV87Jawi2a9jlgcI6Nfcjln5sTce9HCGWeRTNdu 5Btw== X-Forwarded-Encrypted: i=1; AJvYcCUBEDS9za4a2vI7fPKHnEr8qT/gjNaz/wv+IXPhucO/0TNH/2ir69dtILFTj9xeKIHW3JaHbzOSLQF5@vger.kernel.org, AJvYcCUhzq7GJCoAGeY9WRvVkl+mhZ/a7CZlgqlYV6rgteRzj8kGDGHFD/n8G+xpVUWTXPJJQoLnDQp4ANDj@vger.kernel.org, AJvYcCVWW3dESQEtrgxrq5+5QeziGW9W++LrI0wJrayD7/y2b/oEPxUtlXEQHILUgSQclTPYygZ8WLZ2XBuWTCtA@vger.kernel.org, AJvYcCWCeQO9d7L7gRlThjf+qN2WDBpxzCkLr90uF41dt8ZuxRENd+YOrfoyNQiTGVwOQjdrmhaWd90jUbQ2GRw=@vger.kernel.org, AJvYcCWGbJrkqhH95EKs3cCso2bdwT2INFcs7KsJBQ9pfY34r3dn/VOq+QTysC37i6awRUOckWU7bk+zanLqmA==@vger.kernel.org, AJvYcCWzpRelxImtpC1ns9MU1a0HgA/zPTPj0TcC7jf+XU9AZfg11u/fDnp7rCOl5pzVqISxkanBeGILWV2HQvmKrA==@vger.kernel.org, AJvYcCX/w5OUydFlnDiv3ZjPF169iKiv5gTyOzdBHVzLULaa02RbNX8DAKopwLKXOpHbQJzPRRILz2vKlxRKw4A/xsOtk98=@vger.kernel.org, AJvYcCXywwVlct5oS1aTYU2jNn1RfAJTF7PVxv7tjcRaViNvVcVLI0OO9HrHuCdfngbpCQzkqz2TnT3soMD9@vger.kernel.org X-Gm-Message-State: AOJu0YzaM8vjGaJAmlZnvc2HqhfdEViw5KLqoQqPcERVgIOALsAg7oyE DeLpt6LeyU6MnuiTtWXOi+QQoZzZkLN06b/6Yf9qF5KF84B3ZzwT/W2alw== X-Google-Smtp-Source: AGHT+IGBKNI5Hw0ejr5wTOAzZqko2ncnm/G9BUpWyWRp3+NQpm58mdiYixmrMFyeIHbkPTwNF5f3Wg== X-Received: by 2002:a05:6512:68b:b0:52e:fa6b:e54a with SMTP id 2adb3069b0e04-53678fbfb2amr4385322e87.30.1726240112063; Fri, 13 Sep 2024 08:08:32 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:31 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:51 +0300 Subject: [PATCH v4 08/27] mfd: max77693: remove unused declarations Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-8-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=843; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=Q8zEcsu3xOThAfReNawr2bCrmNcwrVa7H+TfC8M0RIc=; b=hHjznQFMl889U4wkRvgPP0WBxOZ7LgBMxuxxVVaN/drKPz4Plhs+ojQQwSc3eNGaDacxx6Sgd TwJoYxSmM4jAg5/qwfRAJ9HCAywMGmtxGmC6O86muRBVykLfkbnswIs X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Remove `enum max77693_irq_source` declaration because unused. Signed-off-by: Dzmitry Sankouski Reviewed-by: Krzysztof Kozlowski --- include/linux/mfd/max77693-private.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index 20c5e02ed9da..c324d548619e 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h @@ -419,17 +419,6 @@ enum max77693_haptic_reg { #define MAX77693_CONFIG2_MEN 6 #define MAX77693_CONFIG2_HTYP 5 -enum max77693_irq_source { - LED_INT = 0, - TOPSYS_INT, - CHG_INT, - MUIC_INT1, - MUIC_INT2, - MUIC_INT3, - - MAX77693_IRQ_GROUP_NR, -}; - #define SRC_IRQ_CHARGER BIT(0) #define SRC_IRQ_TOP BIT(1) #define SRC_IRQ_FLASH BIT(2) From patchwork Fri Sep 13 15:07:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828248 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 3F4AC126C11; Fri, 13 Sep 2024 15:08:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240119; cv=none; b=IP5X7JY6RiXphw120xbCkNFAjM3pI1YVlKnmStb+B9Hz4Wg9sFp8PGlYOiLN9iHtFk8hR8d+OrHwlogCRCj1RvTsT+tEgoi/iLcQpVDG/eMEqS9SHn9bNEwlDsDZxpeLuqOvbAtTOt5Yjt+HzOBzDnwIRsKBx8EcmbCb8Q88aRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240119; c=relaxed/simple; bh=eWs2exiNTe/1MphXSnu9eAWETQoJVaYwSNyZiW7Q6eY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M7qhu2Txa3NHuHAX+Ii3BLf+npXH34Dlb//EWIjMSYWS9TEOs0SqDo5exeKA/UxcFSuT8pEUUEwkas/Qx3LOEVpKPAcaSNzOy78zSSmhz8qdEiERZ7NvOp+SBclRh++EX8nNpdehVAWdtqFqWcOFo5Herwp2qPI4zLD7YNsM6x4= 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=IZF2sQt0; arc=none smtp.client-ip=209.85.208.173 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="IZF2sQt0" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2f75c6ed428so11958091fa.0; Fri, 13 Sep 2024 08:08:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240115; x=1726844915; 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=woiNH/qrHHHDWWK4M7dNp+YIlqFMRVpdfinz+qjwhx8=; b=IZF2sQt0Y3ZeOT02xucnNfO4pTGsWmrp071jsYVBdntE1PCtpBbhh55zZBeLOpkrnV KfNXe2YvdnITgSpy9fl7bAcZqApRncX3PXBOtNMQJI704Np1M7j1pZqcHVFRyqTdYpp8 ikstG3qezBbZl4yWmQb986r0n8ZKZQZzxhEJiuuvSehV44Zjyv5QDFs3vBVtOC2RtdLy 2OllFXaT6oFebf92b/AFjqiAibsSf2Ofj1z1rdkVVECENt1DeOHMC4fuh56TN5/SmEGh +e6XtumW+3nXexn/OitI0Uq9+Bp/wdlP5xsJUTNUjwc9FVQ4wwXeUWwAiowlF3HkcjdI 6J/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240115; x=1726844915; 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=woiNH/qrHHHDWWK4M7dNp+YIlqFMRVpdfinz+qjwhx8=; b=jXr8jH3syKXZNom9e2oxDt9fkfvXbnO26YBsvqaRpD/6h7/bTxQkJTZFN3irZqUH8V JUsM3QbEXl7WxXWSh+Hzf6cQ7ZHwnm4QpGGLcxnFjn0EleBwigRn06I+ZSYNnHjwTYcF KghjQhiNj1+y68ZwquH7g7VlsIVIE/j5dYooa9FcqOBzKrtWUHkqw/WzyEEMqD9W4hI/ VHKEp1hdQf6dEIchGd8crVE/6Ky537pNS/X3xGKLil/ny0WC1asRsrcRGj3dxLbOTVtG ZZflH8DVD+5FVZCoUeFhcyhiC7ZkkwmJ84EfbII+mN5/yTRXnENpy1bEeJ8Dp8OORDiY xjBA== X-Forwarded-Encrypted: i=1; AJvYcCU0A+8YQj6cX7dfjQEB4RuqoCrTNekGnf8oULmVPBb6z29dQcTgD59qe5UDS10fCvO4pXeQEy9FLHDuHfCLeQ==@vger.kernel.org, AJvYcCUT9lDYL13odKEuitBkEukL2Un0wJ9oaARRPGqkqQlyqJQOkheHVgbgezDiFl+zWatOE33OsQDqT1g/@vger.kernel.org, AJvYcCUquqa5sJKXmUh8lSnDGMa/dOXKk3q5usl8634y90yqyRi1eIUlYQKIQeZK7DpoD2qUii/L73oEvr5t@vger.kernel.org, AJvYcCV7x8lE042J3KkjuEpdB9iUo6mXixpxJztiYYxVIUdt7qLp+vteeemWcWMTAHQQIjo01EJxYSWxZOR1/kO0@vger.kernel.org, AJvYcCVVIQjyLdlbisFC/JqMW9MZuviVgl4PMZrPZZA3VS5ZiTFGd/bvt7oGaYVRnoI1xAJfz/jlh1wiVwVAmQ==@vger.kernel.org, AJvYcCVrBgvFv9xyLty9dozO5nkEUw7vcnRDhX0v3uSHssNnjlmbxKr2eJZw07ENyeNleX5Bk4zbOaN+K4kKsZY=@vger.kernel.org, AJvYcCX3VXV70CbzvMAYjgwWuv9ENJ7xP77bAJ3FAgvq07E7rC/dsQ+qyrU+lU+VRnsL2nIOfiosfWo3UGky@vger.kernel.org, AJvYcCX4WAYxhxRa++S3+PVATNF+wr876Nl+UM6JpUIPqZyZ34XG9OEXeGUFUEu07Q5e1Wp02Sl95Rsr1y7yryLc6E1Sk6g=@vger.kernel.org X-Gm-Message-State: AOJu0Yyn3BSRz2BXeaYryk2N5OnRI0SLiALKzdnX4i1wAhobLxc+pG8l 838P7ZF/F8O/11D1fSfzp8qIl+fzgRckkqAVa/i6/knlz7Xlcc7fLC63gw== X-Google-Smtp-Source: AGHT+IGqdCVry3j493Okig51wWTFYA3w2ZRMHzl4atvfom1jJTsg5ShuF26KH/oFLjVyR0iGEOcIdQ== X-Received: by 2002:a2e:be1b:0:b0:2f3:f068:b107 with SMTP id 38308e7fff4ca-2f791b5c8a6mr22840871fa.40.1726240114690; Fri, 13 Sep 2024 08:08:34 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:34 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:52 +0300 Subject: [PATCH v4 09/27] mfd: Add new driver for MAX77705 PMIC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-9-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=18573; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=eWs2exiNTe/1MphXSnu9eAWETQoJVaYwSNyZiW7Q6eY=; b=yc1Rd3GmMTZO+17qfE+Q7qZ+lPrpSUgU85D5Yz2qKAtpFXDF6eEySOHvn9bnA653Tk67/t+m9 q/WvqpdtXVUAQd0k990dv2emeksDSPyQRPsUiP/l+4SvkViuR/Djdqo X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add the core MFD driver for max77705 PMIC. We define five sub-devices for which the drivers will be added in subsequent patches. Signed-off-by: Dzmitry Sankouski --- Changes for V4: - rework driver from scratch - migrate to regmap_add_irq_chip, remove max77705-irq.c, rename max77705-core.c to max77705.c - cleanup headers - remove debugfs code - migrate to use max77693_dev structure - remove max77705.h --- MAINTAINERS | 2 + drivers/mfd/Kconfig | 12 ++ drivers/mfd/Makefile | 2 + drivers/mfd/max77705.c | 248 +++++++++++++++++++++++++++++++++++ include/linux/mfd/max77693-common.h | 6 +- include/linux/mfd/max77705-private.h | 180 +++++++++++++++++++++++++ 6 files changed, 449 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 65cb2511ba22..716e66bb7982 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14072,6 +14072,7 @@ F: drivers/*/*max77843.c F: drivers/*/max14577*.c F: drivers/*/max77686*.c F: drivers/*/max77693*.c +F: drivers/*/max77705*.c F: drivers/clk/clk-max77686.c F: drivers/extcon/extcon-max14577.c F: drivers/extcon/extcon-max77693.c @@ -14079,6 +14080,7 @@ F: drivers/rtc/rtc-max77686.c F: include/linux/mfd/max14577*.h F: include/linux/mfd/max77686*.h F: include/linux/mfd/max77693*.h +F: include/linux/mfd/max77705*.h MAXIRADIO FM RADIO RECEIVER DRIVER M: Hans Verkuil diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index f9325bcce1b9..785aac4cb64b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -904,6 +904,18 @@ config MFD_MAX77693 additional drivers must be enabled in order to use the functionality of the device. +config MFD_MAX77705 + tristate "Maxim Semiconductor MAX77705 PMIC Support" + depends on I2C + select MFD_CORE + help + Say yes here to add support for Maxim Semiconductor MAX77705. + This is a Power Management IC with Charger, safe LDOs, Flash, Haptic + and MUIC controls on chip. + 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_MAX77714 tristate "Maxim Semiconductor MAX77714 PMIC Support" depends on I2C diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 2a9f91e81af8..3dc5742c6aeb 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -167,6 +167,7 @@ obj-$(CONFIG_MFD_MAX77620) += max77620.o obj-$(CONFIG_MFD_MAX77650) += max77650.o obj-$(CONFIG_MFD_MAX77686) += max77686.o obj-$(CONFIG_MFD_MAX77693) += max77693.o +obj-$(CONFIG_MFD_MAX77705) += max77705.o obj-$(CONFIG_MFD_MAX77714) += max77714.o obj-$(CONFIG_MFD_MAX77843) += max77843.o obj-$(CONFIG_MFD_MAX8907) += max8907.o @@ -232,6 +233,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_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/max77705.c b/drivers/mfd/max77705.c new file mode 100644 index 000000000000..2c6a5520964e --- /dev/null +++ b/drivers/mfd/max77705.c @@ -0,0 +1,248 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// max77705.c - mfd core driver for the MAX77705 +// +// Copyright (C) 2024 Dzmitry Sankouski + +#include +#include +#include +#include +#include +#include +#include +#include + +#define I2C_ADDR_CHG (0xD2 >> 1) +#define I2C_ADDR_FG (0x6C >> 1) + +static struct mfd_cell max77705_devs[] = { + { + .name = "leds-max77705-rgb", + .of_compatible = "maxim,max77705-led", + }, + { + .name = "max77705-fuel-gauge", + .of_compatible = "maxim,max77705-fuel-gauge", + }, + { + .name = "max77705-charger", + .of_compatible = "maxim,max77705-charger", + }, + { + .name = "max77705-haptic", + .of_compatible = "maxim,max77705-haptic", + }, +}; + +static const struct regmap_range max77705_readable_ranges[] = { + regmap_reg_range(MAX77705_PMIC_REG_PMICID1, MAX77705_PMIC_REG_BSTOUT_MASK), + regmap_reg_range(MAX77705_PMIC_REG_INTSRC, MAX77705_PMIC_REG_RESERVED_29), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL1, MAX77705_PMIC_REG_BOOSTCONTROL1), + regmap_reg_range(MAX77705_PMIC_REG_MCONFIG, MAX77705_PMIC_REG_MCONFIG2), + regmap_reg_range(MAX77705_PMIC_REG_FORCE_EN_MASK, MAX77705_PMIC_REG_FORCE_EN_MASK), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL1, MAX77705_PMIC_REG_BOOSTCONTROL1), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL2, MAX77705_PMIC_REG_BOOSTCONTROL2), + regmap_reg_range(MAX77705_PMIC_REG_SW_RESET, MAX77705_PMIC_REG_USBC_RESET), +}; + +static const struct regmap_range max77705_writable_ranges[] = { + regmap_reg_range(MAX77705_PMIC_REG_MAINCTRL1, MAX77705_PMIC_REG_BSTOUT_MASK), + regmap_reg_range(MAX77705_PMIC_REG_INTSRC, MAX77705_PMIC_REG_RESERVED_29), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL1, MAX77705_PMIC_REG_BOOSTCONTROL1), + regmap_reg_range(MAX77705_PMIC_REG_MCONFIG, MAX77705_PMIC_REG_MCONFIG2), + regmap_reg_range(MAX77705_PMIC_REG_FORCE_EN_MASK, MAX77705_PMIC_REG_FORCE_EN_MASK), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL1, MAX77705_PMIC_REG_BOOSTCONTROL1), + regmap_reg_range(MAX77705_PMIC_REG_BOOSTCONTROL2, MAX77705_PMIC_REG_BOOSTCONTROL2), + regmap_reg_range(MAX77705_PMIC_REG_SW_RESET, MAX77705_PMIC_REG_USBC_RESET), + +}; + +static const struct regmap_access_table max77705_readable_table = { + .yes_ranges = max77705_readable_ranges, + .n_yes_ranges = ARRAY_SIZE(max77705_readable_ranges), +}; + +static const struct regmap_access_table max77705_writable_table = { + .yes_ranges = max77705_writable_ranges, + .n_yes_ranges = ARRAY_SIZE(max77705_writable_ranges), +}; + +static const struct regmap_config max77705_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .rd_table = &max77705_readable_table, + .wr_table = &max77705_writable_table, + .max_register = MAX77705_PMIC_REG_USBC_RESET, +}; + +static const struct regmap_config max77705_leds_regmap_config = { + .reg_base = MAX77705_RGBLED_REG_BASE, + .reg_bits = 8, + .val_bits = 8, + .max_register = MAX77705_LED_REG_END, +}; + +static const struct regmap_config max77705_chg_regmap_config = { + .reg_base = MAX77705_CHG_REG_BASE, + .reg_bits = 8, + .val_bits = 8, + .max_register = MAX77705_CHG_REG_SAFEOUT_CTRL, +}; + +static const struct regmap_config max77705_fg_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = MAX77705_FG_END, +}; + +static const struct regmap_irq max77705_topsys_irqs[] = { + { .mask = MAX77705_SYSTEM_IRQ_BSTEN_INT, }, + { .mask = MAX77705_SYSTEM_IRQ_SYSUVLO_INT, }, + { .mask = MAX77705_SYSTEM_IRQ_SYSOVLO_INT, }, + { .mask = MAX77705_SYSTEM_IRQ_TSHDN_INT, }, + { .mask = MAX77705_SYSTEM_IRQ_TM_INT, }, +}; + +static const struct regmap_irq_chip max77705_topsys_irq_chip = { + .name = "max77705-topsys", + .status_base = MAX77705_PMIC_REG_SYSTEM_INT, + .mask_base = MAX77705_PMIC_REG_SYSTEM_INT_MASK, + .num_regs = 1, + .irqs = max77705_topsys_irqs, + .num_irqs = ARRAY_SIZE(max77705_topsys_irqs), +}; + +static int max77705_i2c_probe(struct i2c_client *i2c) +{ + struct max77693_dev *max77705; + struct i2c_client *i2c_chg; + struct i2c_client *i2c_fg; + struct regmap_irq_chip_data *irq_data; + struct irq_domain *domain; + int ret; + unsigned int pmic_rev_value; + u8 pmic_ver, pmic_rev; + + + max77705 = devm_kzalloc(&i2c->dev, sizeof(struct max77693_dev), + GFP_KERNEL); + if (!max77705) + return -ENOMEM; + + max77705->dev = &i2c->dev; + max77705->irq = i2c->irq; + max77705->type = TYPE_MAX77705; + i2c_set_clientdata(i2c, max77705); + + max77705->regmap = devm_regmap_init_i2c(i2c, &max77705_regmap_config); + if (IS_ERR(max77705->regmap)) + return PTR_ERR(max77705->regmap); + + if (regmap_read(max77705->regmap, MAX77705_PMIC_REG_PMICREV, &pmic_rev_value) < 0) + return -ENODEV; + + pmic_rev = (pmic_rev_value & MAX77705_REVISION_MASK); + pmic_ver = ((pmic_rev_value & MAX77705_VERSION_MASK) >> MAX77705_VERSION_SHIFT); + dev_dbg(max77705->dev, "device found: rev.0x%x, ver.0x%x\n", + pmic_rev, pmic_ver); + if (pmic_rev != MAX77705_PASS3) { + dev_err(max77705->dev, "rev.0x%x is not tested", + pmic_rev); + return -ENODEV; + } + + max77705->regmap_leds = devm_regmap_init_i2c(i2c, &max77705_leds_regmap_config); + if (IS_ERR(max77705->regmap_leds)) + return PTR_ERR(max77705->regmap_leds); + + i2c_chg = devm_i2c_new_dummy_device(max77705->dev, + i2c->adapter, I2C_ADDR_CHG); + max77705->regmap_chg = devm_regmap_init_i2c(i2c_chg, + &max77705_chg_regmap_config); + if (IS_ERR(max77705->regmap_chg)) + return PTR_ERR(max77705->regmap_chg); + + i2c_fg = devm_i2c_new_dummy_device(max77705->dev, i2c->adapter, + I2C_ADDR_FG); + max77705->regmap_fg = devm_regmap_init_i2c(i2c_fg, + &max77705_fg_regmap_config); + if (IS_ERR(max77705->regmap_fg)) + return PTR_ERR(max77705->regmap_fg); + + ret = devm_regmap_add_irq_chip(max77705->dev, max77705->regmap, + max77705->irq, + IRQF_ONESHOT | IRQF_SHARED, 0, + &max77705_topsys_irq_chip, + &irq_data); + if (ret) + dev_err(max77705->dev, "failed to add irq chip: %d\n", ret); + + /* Unmask interrupts from all blocks in interrupt source register */ + ret = regmap_update_bits(max77705->regmap, + MAX77705_PMIC_REG_INTSRC_MASK, + MAX77705_SRC_IRQ_ALL, (unsigned int)~MAX77705_SRC_IRQ_ALL); + if (ret < 0) + dev_err(max77705->dev, + "Could not unmask interrupts in INTSRC: %d\n", ret); + + domain = regmap_irq_get_domain(irq_data); + ret = devm_mfd_add_devices(max77705->dev, PLATFORM_DEVID_NONE, + max77705_devs, ARRAY_SIZE(max77705_devs), + NULL, 0, domain); + if (ret) { + dev_err(max77705->dev, "failed to add MFD devices: %d\n", ret); + return ret; + } + + device_init_wakeup(max77705->dev, true); + + return 0; +} + +static int max77705_suspend(struct device *dev) +{ + struct i2c_client *i2c = to_i2c_client(dev); + struct max77693_dev *max77705 = i2c_get_clientdata(i2c); + + disable_irq(max77705->irq); + if (device_may_wakeup(dev)) + enable_irq_wake(max77705->irq); + + return 0; +} + +static int max77705_resume(struct device *dev) +{ + struct i2c_client *i2c = to_i2c_client(dev); + struct max77693_dev *max77705 = i2c_get_clientdata(i2c); + + if (device_may_wakeup(dev)) + disable_irq_wake(max77705->irq); + enable_irq(max77705->irq); + + return 0; +} + +DEFINE_SIMPLE_DEV_PM_OPS(max77705_pm_ops, max77705_suspend, max77705_resume); + +static const struct of_device_id max77705_i2c_dt_ids[] = { + { .compatible = "maxim,max77705" }, + { }, +}; +MODULE_DEVICE_TABLE(of, max77705_i2c_dt_ids); + +static struct i2c_driver max77705_i2c_driver = { + .driver = { + .name = "max77705", + .of_match_table = max77705_i2c_dt_ids, + .pm = pm_sleep_ptr(&max77705_pm_ops), + .suppress_bind_attrs = true, + }, + .probe = max77705_i2c_probe, +}; +module_i2c_driver(max77705_i2c_driver); + +MODULE_DESCRIPTION("MAXIM 77705 multi-function core driver"); +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/max77693-common.h b/include/linux/mfd/max77693-common.h index a5bce099f1ed..1b87b1ada21c 100644 --- a/include/linux/mfd/max77693-common.h +++ b/include/linux/mfd/max77693-common.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Common data shared between Maxim 77693 and 77843 drivers + * Common data shared between Maxim 77693, 77705 and 77843 drivers * * Copyright (C) 2015 Samsung Electronics */ @@ -11,6 +11,7 @@ enum max77693_types { TYPE_MAX77693_UNKNOWN, TYPE_MAX77693, + TYPE_MAX77705, TYPE_MAX77843, TYPE_MAX77693_NUM, @@ -25,6 +26,7 @@ struct max77693_dev { struct i2c_client *i2c_muic; /* 0x4A , MUIC */ struct i2c_client *i2c_haptic; /* MAX77693: 0x90 , Haptic */ struct i2c_client *i2c_chg; /* MAX77843: 0xD2, Charger */ + struct i2c_client *i2c_fg; /* MAX77843: 0xD2, Charger */ enum max77693_types type; @@ -32,6 +34,8 @@ struct max77693_dev { struct regmap *regmap_muic; struct regmap *regmap_haptic; /* Only MAX77693 */ struct regmap *regmap_chg; /* Only MAX77843 */ + struct regmap *regmap_fg; /* Only MAX77705 */ + struct regmap *regmap_leds; /* Only MAX77705 */ struct regmap_irq_chip_data *irq_data_led; struct regmap_irq_chip_data *irq_data_topsys; diff --git a/include/linux/mfd/max77705-private.h b/include/linux/mfd/max77705-private.h new file mode 100644 index 000000000000..2fbc1c345724 --- /dev/null +++ b/include/linux/mfd/max77705-private.h @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +// +// Maxim MAX77705 definitions. +// +// Copyright (C) 2015 Samsung Electronics, Inc. +// Copyright (C) 2024 Dzmitry Sankouski + +#ifndef __LINUX_MFD_MAX77705_PRIV_H +#define __LINUX_MFD_MAX77705_PRIV_H + +#include + +#define MAX77705_SRC_IRQ_CHG BIT(0) +#define MAX77705_SRC_IRQ_TOP BIT(1) +#define MAX77705_SRC_IRQ_FG BIT(2) +#define MAX77705_SRC_IRQ_USBC BIT(3) +#define MAX77705_SRC_IRQ_ALL (MAX77705_SRC_IRQ_CHG | MAX77705_SRC_IRQ_TOP | \ + MAX77705_SRC_IRQ_FG | MAX77705_SRC_IRQ_USBC) + +// MAX77705_PMIC_REG_PMICREV register +#define MAX77705_VERSION_SHIFT 3 +#define MAX77705_REVISION_MASK GENMASK(2, 0) +#define MAX77705_VERSION_MASK GENMASK(7, MAX77705_VERSION_SHIFT) +// MAX77705_PMIC_REG_MAINCTRL1 register +#define MAX77705_MAINCTRL1_BIASEN_SHIFT 7 +#define MAX77705_MAINCTRL1_BIASEN_MASK BIT(MAX77705_MAINCTRL1_BIASEN_SHIFT) +// MAX77705_PMIC_REG_MCONFIG2 (haptics) register +#define MAX77705_CONFIG2_MEN_SHIFT 6 +#define MAX77705_CONFIG2_MODE_SHIFT 7 +#define MAX77705_CONFIG2_HTYP_SHIFT 5 +// MAX77705_PMIC_REG_SYSTEM_INT_MASK register +#define MAX77705_SYSTEM_IRQ_BSTEN_INT BIT(3) +#define MAX77705_SYSTEM_IRQ_SYSUVLO_INT BIT(4) +#define MAX77705_SYSTEM_IRQ_SYSOVLO_INT BIT(5) +#define MAX77705_SYSTEM_IRQ_TSHDN_INT BIT(6) +#define MAX77705_SYSTEM_IRQ_TM_INT BIT(7) + +enum max77705_hw_rev { + MAX77705_PASS1 = 1, + MAX77705_PASS2, + MAX77705_PASS3, +}; + +enum max77705_reg { + MAX77705_PMIC_REG_PMICID1 = 0x00, + MAX77705_PMIC_REG_PMICREV = 0x01, + MAX77705_PMIC_REG_MAINCTRL1 = 0x02, + MAX77705_PMIC_REG_BSTOUT_MASK = 0x03, + MAX77705_PMIC_REG_FORCE_EN_MASK = 0x08, + MAX77705_PMIC_REG_MCONFIG = 0x10, + MAX77705_PMIC_REG_MCONFIG2 = 0x11, + MAX77705_PMIC_REG_INTSRC = 0x22, + MAX77705_PMIC_REG_INTSRC_MASK = 0x23, + MAX77705_PMIC_REG_SYSTEM_INT = 0x24, + MAX77705_PMIC_REG_RESERVED_25 = 0x25, + MAX77705_PMIC_REG_SYSTEM_INT_MASK = 0x26, + MAX77705_PMIC_REG_RESERVED_27 = 0x27, + MAX77705_PMIC_REG_RESERVED_28 = 0x28, + MAX77705_PMIC_REG_RESERVED_29 = 0x29, + MAX77705_PMIC_REG_BOOSTCONTROL1 = 0x4C, + MAX77705_PMIC_REG_BOOSTCONTROL2 = 0x4F, + MAX77705_PMIC_REG_SW_RESET = 0x50, + MAX77705_PMIC_REG_USBC_RESET = 0x51, + + MAX77705_PMIC_REG_END, +}; + +enum max77705_chg_reg { + MAX77705_CHG_REG_BASE = 0xB0, + MAX77705_CHG_REG_INT = 0, + MAX77705_CHG_REG_INT_MASK, + MAX77705_CHG_REG_INT_OK, + MAX77705_CHG_REG_DETAILS_00, + MAX77705_CHG_REG_DETAILS_01, + MAX77705_CHG_REG_DETAILS_02, + MAX77705_CHG_REG_DTLS_03, + MAX77705_CHG_REG_CNFG_00, + MAX77705_CHG_REG_CNFG_01, + MAX77705_CHG_REG_CNFG_02, + MAX77705_CHG_REG_CNFG_03, + MAX77705_CHG_REG_CNFG_04, + MAX77705_CHG_REG_CNFG_05, + MAX77705_CHG_REG_CNFG_06, + MAX77705_CHG_REG_CNFG_07, + MAX77705_CHG_REG_CNFG_08, + MAX77705_CHG_REG_CNFG_09, + MAX77705_CHG_REG_CNFG_10, + MAX77705_CHG_REG_CNFG_11, + MAX77705_CHG_REG_CNFG_12, + MAX77705_CHG_REG_CNFG_13, + MAX77705_CHG_REG_CNFG_14, + MAX77705_CHG_REG_SAFEOUT_CTRL, +}; + +enum max77705_fuelgauge_reg { + STATUS_REG = 0x00, + VALRT_THRESHOLD_REG = 0x01, + TALRT_THRESHOLD_REG = 0x02, + SALRT_THRESHOLD_REG = 0x03, + REMCAP_REP_REG = 0x05, + SOCREP_REG = 0x06, + TEMPERATURE_REG = 0x08, + VCELL_REG = 0x09, + TIME_TO_EMPTY_REG = 0x11, + FULLSOCTHR_REG = 0x13, + CURRENT_REG = 0x0A, + AVG_CURRENT_REG = 0x0B, + SOCMIX_REG = 0x0D, + SOCAV_REG = 0x0E, + REMCAP_MIX_REG = 0x0F, + FULLCAP_REG = 0x10, + RFAST_REG = 0x15, + AVR_TEMPERATURE_REG = 0x16, + CYCLES_REG = 0x17, + DESIGNCAP_REG = 0x18, + AVR_VCELL_REG = 0x19, + TIME_TO_FULL_REG = 0x20, + CONFIG_REG = 0x1D, + ICHGTERM_REG = 0x1E, + REMCAP_AV_REG = 0x1F, + FULLCAP_NOM_REG = 0x23, + LEARN_CFG_REG = 0x28, + FILTER_CFG_REG = 0x29, + MISCCFG_REG = 0x2B, + QRTABLE20_REG = 0x32, + FULLCAP_REP_REG = 0x35, + RCOMP_REG = 0x38, + VEMPTY_REG = 0x3A, + FSTAT_REG = 0x3D, + DISCHARGE_THRESHOLD_REG = 0x40, + QRTABLE30_REG = 0x42, + ISYS_REG = 0x43, + DQACC_REG = 0x45, + DPACC_REG = 0x46, + AVGISYS_REG = 0x4B, + QH_REG = 0x4D, + VSYS_REG = 0xB1, + TALRTTH2_REG = 0xB2, + VBYP_REG = 0xB3, + CONFIG2_REG = 0xBB, + IIN_REG = 0xD0, + OCV_REG = 0xEE, + VFOCV_REG = 0xFB, + VFSOC_REG = 0xFF, + + MAX77705_FG_END, +}; + +enum max77705_led_reg { + MAX77705_RGBLED_REG_BASE = 0x30, + MAX77705_RGBLED_REG_LEDEN = 0, + MAX77705_RGBLED_REG_LED0BRT, + MAX77705_RGBLED_REG_LED1BRT, + MAX77705_RGBLED_REG_LED2BRT, + MAX77705_RGBLED_REG_LED3BRT, + MAX77705_RGBLED_REG_LEDRMP, + MAX77705_RGBLED_REG_LEDBLNK, + MAX77705_LED_REG_END +}; + +enum max77705_charger_battery_state { + MAX77705_BATTERY_NOBAT, + MAX77705_BATTERY_PREQUALIFICATION, + MAX77705_BATTERY_DEAD, + MAX77705_BATTERY_GOOD, + MAX77705_BATTERY_LOWVOLTAGE, + MAX77705_BATTERY_OVERVOLTAGE, + MAX77705_BATTERY_RESERVED, +}; + +enum max77705_charger_charge_type { + MAX77705_CHARGER_CONSTANT_CURRENT = 1, + MAX77705_CHARGER_CONSTANT_VOLTAGE, + MAX77705_CHARGER_END_OF_CHARGE, + MAX77705_CHARGER_DONE, +}; + +extern const struct dev_pm_ops max77705_pm_ops; + +#endif /* __LINUX_MFD_MAX77705_PRIV_H */ From patchwork Fri Sep 13 15:07: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: 828678 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 2F59312D758; Fri, 13 Sep 2024 15:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240121; cv=none; b=ZT2panYD6nS/PC3UTeFRdJ4x69tjCZAuPh5vyeuHOEXGsmUPS9CilulscJo/QorFoiuR0NixmTMBFEOQ00XFMCQwrQn1Rxo/Juj0Elh2kI4emOJK/O+F+OZnniGOLILvAlgiXMNUPSBrd9Mj6KXFOoJIsgRtfqo+On9JyoxbfsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240121; c=relaxed/simple; bh=JLT3fRS+yl6/Mb+tf79ZnYVcgNkISumMGZ+lQQFDBZo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GDuWwi7OGpSokKRnKatuf8pR/s22QYGR52rR4PppBsa6EXGqZtA6hVQ9vOE15FRdlibWWHN2x1MhfytDK1+LXpafvAmIPjrGboLMQllcTJWJbfPwdu0rnbZVVG+PmlPxU5y1Bh+Jn8IncIT/YwO29z56dQGMYyXS/b3pvhvXA4o= 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=hkEen/ds; arc=none smtp.client-ip=209.85.208.47 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="hkEen/ds" Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5bef295a429so2923898a12.2; Fri, 13 Sep 2024 08:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240118; x=1726844918; 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=KGV3WmFsQ+1pAhEILcS0ZUWipFofO4AxkBOKtNoxFJE=; b=hkEen/dsdSlXIUSEW9aK49FNJA9he8X1jKv41PJ2s/KKftianzh6/IZS8X1GgneILN 51ArwE8gBIGASN1rL3CV8XG8s4zIrh99h+8c/7UbsSQRyz6hlOI6dIYUoK2MZLZ204LC 6KP42zUIa/ctBLLj38mEqKhFfaQOs/xHNmc9aDSEWjvlKhf6RKRPN5csobHGwoJmfC78 KEaXdA9DVkyFmi4OmUfks1j3c01sICHgjBPC1kxfQtdCn5zuYCqW1ARe8Q0n0PpR+K+C hdmx85gIk2qkWsXMk0oXFnTtksfw33RosFuTORdJEhiVxxBcZ+27gS3q7w++NDinKL/g w/6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240118; x=1726844918; 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=KGV3WmFsQ+1pAhEILcS0ZUWipFofO4AxkBOKtNoxFJE=; b=vqK9TmOZybCJ9nQftx1FagdYwwQp2cU5T/70AnczGo4n/J+p1oyjox0WSRkfPNnSuX +pMjC2U3eoZHAkB/Ex5XLmtlOjmGKtOXqOiRGtOC01N/vyhXCUTSdabY8maOz9YZlhtt TjpWGXczWhIGDX/HCqInyRkrGKvR1j1l0SAofPQkClyGKLx/Vj8ah8GNxRuRZo6GJ+ID FGYaSX3gzNBChgOa+rJn40tS4K98sUnDXW7jA9jjIkfzUWHvMfmf/eVdrvtpuU5Lv0/n i0VDjvYD3od5NqViTHaZCCVelRXSCzIGO3V8PffzinojGrKOHhlm9JP85ZjwiizrWbOn 6nDQ== X-Forwarded-Encrypted: i=1; AJvYcCU3sDCXySc36MAdGG7bHQkrY8nWnkvqyol55xuHlsTLob8U3seddpBzMfu7rvtd+aLL6GTfh+ChcmLl/FevdcQyEmQ=@vger.kernel.org, AJvYcCUTiVZSyIJEbOXCRhhtksHwvblHGVLoicVkBJEv5SAPWfvDVdsLykE/8dy3sHXuaeaDp2ZjY+00glmQYw==@vger.kernel.org, AJvYcCVBXsHWm6ITvTlXbStlQ4x9YPyvoNfQVS/8i7rbEWHM+x+ZvYdmLh1ZxxfOYhCjHQlSVFOVnjYx8n/Pesz2@vger.kernel.org, AJvYcCW/EcLo72eiWGT54K7ro9jaSxDsp0G+884dBNaCUPNDYkoWdAuo79qYqLRlebIy53kuSfyuHBZbo1Xme4g=@vger.kernel.org, AJvYcCWNXwgGRw2Utktud9Cz72bIqX0Xpeuhq2YLrd2lhWQbUi7mBBHXdkJM/+9/i1O8BfBJxOSgxQHwR5IPvpqZMQ==@vger.kernel.org, AJvYcCWXV5QvBbkblLC/o5d2xovSYvkoOlRXcSnTD2gQNzahgzoW1/dgWDq9idxnqApR7AFQcngl7Viza9Gq@vger.kernel.org, AJvYcCWZl62T+FRUTk7vYJPmAqoGp49axgt50e4sY++DTz9m1VhJo1pgY+ZmstM+q+cvP3I5my0lq/8DIr30@vger.kernel.org, AJvYcCXrd3F2O/oUNulJpla51pdilMX/OWjoiT9v3j8DtL6BMZaN/3QYcgDsBeVhGjFuhXTdKVR8tqTBr3RV@vger.kernel.org X-Gm-Message-State: AOJu0YycGEcjvNW51PTD3R2cFkfd893/Qhs4/kZAq7kgzbS2PHKlOlVf JjwKTxlncVVbVEhbgUhsNW/Gsyyjlh43SeAMsGpdDYZxsVoTQDuujNRxMA== X-Google-Smtp-Source: AGHT+IHmet3oVeZAIyzfyGhQipzCR5J7qgVMqR0U3qlYsOGLKQIFYN4djfEUjPbQ4Oc1wrwDnPBcKg== X-Received: by 2002:a50:cc07:0:b0:5bf:2577:32b8 with SMTP id 4fb4d7f45d1cf-5c413e10d16mr4591778a12.9.1726240118059; Fri, 13 Sep 2024 08:08:38 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:36 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:53 +0300 Subject: [PATCH v4 10/27] input: max77693: add max77705 haptic support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-10-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=4227; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=JLT3fRS+yl6/Mb+tf79ZnYVcgNkISumMGZ+lQQFDBZo=; b=QWXeiajPIVlTrdpZ46bVxljmi2LWiwS0GqKpCG23HcYVw+Bp9aq3S2iNDvOVLBwdKDhO61jha OvHVW13g2C0BqFw1fsSf6jd+d1jSYQFH6MfjPlYVXo0cT3tjjJXeRfN 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 --- Changes in v4: - add max77705 haptic support to max77693 driver - delete max77705-haptic --- drivers/input/misc/Kconfig | 4 ++-- drivers/input/misc/Makefile | 1 + drivers/input/misc/max77693-haptic.c | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 6a852c76331b..b4515c4e5cf6 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -241,11 +241,11 @@ config INPUT_MAX77650_ONKEY config INPUT_MAX77693_HAPTIC tristate "MAXIM MAX77693/MAX77843 haptic controller support" - depends on (MFD_MAX77693 || MFD_MAX77843) && PWM + depends on (MFD_MAX77693 || MFD_MAX77705 || MFD_MAX77843) && PWM select INPUT_FF_MEMLESS help This option enables support for the haptic controller on - MAXIM MAX77693 and MAX77843 chips. + MAXIM MAX77693, MAX77705 and MAX77843 chips. To compile this driver as module, choose M here: the module will be called max77693-haptic. diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 4f7f736831ba..3e3532b27990 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -53,6 +53,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/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 0e646f1b257b..c3b9d33608d7 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #define MAX_MAGNITUDE_SHIFT 16 @@ -115,6 +116,13 @@ static int max77693_haptic_configure(struct max77693_haptic *haptic, MAX77693_HAPTIC_PWM_DIVISOR_128); config_reg = MAX77693_HAPTIC_REG_CONFIG2; break; + case TYPE_MAX77705: + value = ((haptic->type << MAX77693_CONFIG2_MODE) | + (enable << MAX77693_CONFIG2_MEN) | + (haptic->mode << MAX77693_CONFIG2_HTYP) | + MAX77693_HAPTIC_PWM_DIVISOR_128); + config_reg = MAX77705_PMIC_REG_MCONFIG; + break; case TYPE_MAX77843: value = (haptic->type << MCONFIG_MODE_SHIFT) | (enable << MCONFIG_MEN_SHIFT) | @@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev) case TYPE_MAX77693: haptic->regmap_haptic = max77693->regmap_haptic; break; + case TYPE_MAX77705: + haptic->regmap_haptic = max77693->regmap; + break; case TYPE_MAX77843: haptic->regmap_haptic = max77693->regmap; break; @@ -407,6 +418,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, static const struct platform_device_id max77693_haptic_id[] = { { "max77693-haptic", }, + { "max77705-haptic", }, { "max77843-haptic", }, {}, }; @@ -414,6 +426,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id); static const struct of_device_id of_max77693_haptic_dt_match[] = { { .compatible = "maxim,max77693-haptic", }, + { .compatible = "maxim,max77705-haptic", }, { .compatible = "maxim,max77843-haptic", }, { /* sentinel */ }, }; @@ -432,5 +445,5 @@ module_platform_driver(max77693_haptic_driver); MODULE_AUTHOR("Jaewon Kim "); MODULE_AUTHOR("Krzysztof Kozlowski "); -MODULE_DESCRIPTION("MAXIM 77693/77843 Haptic driver"); +MODULE_DESCRIPTION("MAXIM 77693/77705/77843 Haptic driver"); MODULE_LICENSE("GPL"); From patchwork Fri Sep 13 15:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828247 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 7CFD2139D07; Fri, 13 Sep 2024 15:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240126; cv=none; b=RDwoEE6R5AdrNkJVWBZeO+8cv5SWK5NS4Lg9Vqf1DZz6gu8m1IBneqTYok5HLTvazMtv85bSVcH5kXBbAScBm7urEPa5dMp8monQxDkjI5FD5qcil1HjkvyhhEU6r6wLCP8u4OuYCQ4graAvgV40K51oJHpWdlkVK5anIcEZiYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240126; c=relaxed/simple; bh=d5dWJiikI4IO7l119IBFrEXYeK41eMLJ/VkVYTF/BJg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dskz+ewFJvETXcpCVgTeeF1cqpVJvdMvCC1XF9ccc07eEGSJlrgCeTMT4j2se0D8+BdjJeIMX4jfdJu/6goqtoj85W37YW02ZAL7A0tHf9KrZU8FCKbnN62QRvFr/SisytVm0Qqu50J8bp472ZUz7Sgr+Utrb19gLnswilv/Pw4= 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=l/My3Y36; arc=none smtp.client-ip=209.85.208.171 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="l/My3Y36" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2f759b87f83so26616091fa.2; Fri, 13 Sep 2024 08:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240121; x=1726844921; 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=IB0OvKXabr19zYa9WIrrxruAHRwZHynm68PMTA4LVbI=; b=l/My3Y36nemAbRGvAOB/9PO1TrF1bgMsI+cpmg7Fau6ISBjU2RO+Mgq8bvT4fof9/w jCDiKEAp1jn2Y6YHGdmbik6uVHq36jlVXhO8lXdOfwxakaPvkorKQMw36cQ7ILSiUTVB 4pISI2lVFWx8PtzPOKF2xoI6dbDnXtzk2FbYcPcQ2YlpSJ8EPKC8Szwb/RIl43zEUC+/ iVjgzEUlc67+URjbd7zUu4rntJpHnMKBENjf6ixD12Y+kzyUhT7nCv/1O8xrkTzdp9pk ZixFvuef+c3NZ5UpDurqjw8wVi7XGt3zgDogXmJZIT+oBEKi9zJ4+/Vys6UivuYRLEZJ V4eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240121; x=1726844921; 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=IB0OvKXabr19zYa9WIrrxruAHRwZHynm68PMTA4LVbI=; b=iO4hXbXBXDv12lTx7Ty1NkTCgL6eyEcOULBUocfI7FzTCRw8jzrZJ9kKzCdRmcH8/a KwZ4aAYS6Ku9iq25IOA+o7XP/oLtxHV7F5MbyMzVGBvbioBKFhrNfRC6g5X7e3VcGqId oIS59lyqn8nZ3KDY8JYWEczAbNUNSV49fc6mqTM4rfmJb+WDLfR1ZYzzTaz0zFDnXcCy QGzqFPNplOjOdIX6nkZy1aHp+iUCufIhiPbQoGZBa8NQhRYtiIabLZwzU0eAXFHyLxTn S5i/Cn5Eys85j6p4JX5O2c6ZM4ZdqTXYO/OZ70TGr5VkvEVHiol+LCYq8P/EUxHNDpWv b3/A== X-Forwarded-Encrypted: i=1; AJvYcCW/mKdqvk1e//Stn9DWf0ZUn39VoCmNfLFGdJ2KqTbhkOon0HBQtONmJ0U8zKdqXu4xO8v9XENDCYn6I4Q=@vger.kernel.org, AJvYcCWKUZx1nfipPk5J9McpOT7udPw8P6/NiDTP91IwFl2gjb6VEce+FvfbWvgzuAyeOBSH6iEv0tiyYfI5@vger.kernel.org, AJvYcCWPsgRURbCteA+lNUNakCzgNKSr4EYqN2ETVydVY8wnlXM57qBbokfJyQ+R5sQV2cAHMkZRyO3yWi2Ssw==@vger.kernel.org, AJvYcCWSSaQjiIMTCGTbGFrW1Q9qwRs7JXVYNvRkrsRD/CeWdGNNb1JWqvaSoz2/FYD4Pv3lTh/dCL3ewHhdmzqaNLbwzhQ=@vger.kernel.org, AJvYcCWnH/mykEgDLq2/EQ2RtR+kmSn6A9eDA3HCaBnx2ImqJDFtpjVH8aX2HN4sp0bM5iLl1BpxA4vrXRAU@vger.kernel.org, AJvYcCWsVtfUquIj5/3qY6Vk7kFNHd2VFdMw7H0pL5xutl0WO0a+V4R4EScKq8KDXr32QB51V+rPOeH5tEQO3IPR4g==@vger.kernel.org, AJvYcCXNwiIgczDZSMVEHDhKMNLIu81Qnj4m5JsZM0GnrsPQhxdcQrLiN4jukAt5uyNsZSLygonzO1T5W7EU3f8r@vger.kernel.org, AJvYcCXy/g5mFNBypu1D4wKXfaWOiVMtSDBIB+wFeL3F0SqwNVfXfC9XqVy31APqPqa7BlzbXSXlIMrWFoT2@vger.kernel.org X-Gm-Message-State: AOJu0Yw5aNKzBlh6IeDcJ8G4o+GXJf+Q3qmq6pnDJmD4rjzaG1tk6kqn MZcNi0Ux8prwXMVJD+Oz2nX7oMcKJJQBySAnxNPq/AsRIZRWf7W+9vd5kw== X-Google-Smtp-Source: AGHT+IGYRjSGu4RGEPucS8kVidK1WRkX8feoO5YIX47ahQIeDKYxCorc7cA/B9h/QOKlNzkfP6tFqw== X-Received: by 2002:a2e:4c11:0:b0:2f7:4df2:6a13 with SMTP id 38308e7fff4ca-2f787ee68e7mr31830491fa.25.1726240121157; Fri, 13 Sep 2024 08:08:41 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:40 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:54 +0300 Subject: [PATCH v4 11/27] power: supply: max77705: Add charger 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: <20240913-starqltechn_integration_upstream-v4-11-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=26737; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=d5dWJiikI4IO7l119IBFrEXYeK41eMLJ/VkVYTF/BJg=; b=Lw+PPZZt6NhHHJ74Hjsyv7PosO6KdXY+neHhkchTCJ7jJrPzgPaFqmVLT/L3Or0mZBVc1uQYM xpeq3yfBP/KAJ0LtfAtz6awmlG6HwrczH3alHyD5eqI6SydighNcJ5q X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add driver for Maxim 77705 switch-mode charger (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 --- Changes for V4: - start from scratch - change word delimiters in filenames to '_' - use GENMASK in header - remove debugfs code - migrate to regmap_add_irq_chip - fix property getters to follow the same style --- drivers/power/supply/Kconfig | 6 + drivers/power/supply/Makefile | 1 + drivers/power/supply/max77705_charger.c | 585 ++++++++++++++++++++++++++++++++ include/linux/mfd/max77705_charger.h | 215 ++++++++++++ 4 files changed, 807 insertions(+) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index bcfa63fb9f1e..fe84d2004f57 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -573,6 +573,12 @@ config CHARGER_MAX77693 help Say Y to enable support for the Maxim MAX77693 battery charger. +config CHARGER_MAX77705 + tristate "Maxim MAX77705 battery charger driver" + depends on MFD_MAX77705 + help + Say Y to enable support for the Maxim MAX77705 battery charger. + 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 8dcb41545317..daa9228fa04b 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -79,6 +79,7 @@ obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o 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_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_charger.c b/drivers/power/supply/max77705_charger.c new file mode 100644 index 000000000000..2d82c6663002 --- /dev/null +++ b/drivers/power/supply/max77705_charger.c @@ -0,0 +1,585 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Based on max77650-charger.c: +// Copyright (C) 2018 BayLibre SAS +// Author: Bartosz Golaszewski +// +// Copyright (C) 2024 Dzmitry Sankouski +// +// Battery charger driver for MAXIM 77705 charger/power-supply. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *max77705_charger_model = "max77705"; +static const char *max77705_charger_manufacturer = "Maxim Integrated"; + +static enum power_supply_property max77705_charger_props[] = { + POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_PRESENT, + POWER_SUPPLY_PROP_STATUS, + POWER_SUPPLY_PROP_CHARGE_TYPE, + POWER_SUPPLY_PROP_HEALTH, + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, + POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, +}; + +static int max77705_chgin_irq(void *irq_drv_data) +{ + struct max77705_charger_data *charger = irq_drv_data; + + queue_work(charger->wqueue, &charger->chgin_work); + + return 0; +} + +static const struct regmap_irq max77705_charger_irqs[] = { + { .mask = MAX77705_BYP_IM, }, + { .mask = MAX77705_INP_LIMIT_IM, }, + { .mask = MAX77705_BATP_IM, }, + { .mask = MAX77705_BAT_IM, }, + { .mask = MAX77705_CHG_IM, }, + { .mask = MAX77705_WCIN_IM, }, + { .mask = MAX77705_CHGIN_IM, }, + { .mask = MAX77705_AICL_IM, }, +}; + +static const struct regmap_irq_chip max77705_charger_irq_chip = { + .name = "max77705-charger", + .status_base = MAX77705_CHG_REG_INT, + .mask_base = MAX77705_CHG_REG_INT_MASK, + .handle_post_irq = max77705_chgin_irq, + .num_regs = 1, + .irqs = max77705_charger_irqs, + .num_irqs = ARRAY_SIZE(max77705_charger_irqs), +}; + +static int max77705_charger_enable(struct max77705_charger_data *chg) +{ + int rv; + + rv = regmap_update_bits(chg->regmap, MAX77705_CHG_REG_CNFG_09, + MAX77705_CHG_EN_MASK, MAX77705_CHG_EN_MASK); + if (rv) + dev_err(chg->dev, "unable to enable the charger: %d\n", rv); + + return rv; +} + +static void max77705_charger_disable(struct max77705_charger_data *chg) +{ + int rv; + + rv = regmap_update_bits(chg->regmap, + MAX77705_CHG_REG_CNFG_09, + MAX77705_CHG_EN_MASK, + MAX77705_CHG_DISABLE); + if (rv) + dev_err(chg->dev, "unable to disable the charger: %d\n", rv); +} + +static int max77705_get_online(struct regmap *regmap, int *val) +{ + unsigned int data; + int ret; + + ret = regmap_read(regmap, MAX77705_CHG_REG_INT_OK, &data); + if (ret < 0) + return ret; + + *val = !!(data & MAX77705_CHGIN_OK); + + return 0; +} + +static int max77705_check_battery(struct max77705_charger_data *charger, int *val) +{ + unsigned int reg_data; + unsigned int reg_data2; + struct regmap *regmap = charger->regmap; + + + regmap_read(regmap, MAX77705_CHG_REG_INT_OK, ®_data); + + dev_dbg(charger->dev, "CHG_INT_OK(0x%x)\n", reg_data); + + regmap_read(regmap, + MAX77705_CHG_REG_DETAILS_00, ®_data2); + + dev_dbg(charger->dev, "CHG_DETAILS00(0x%x)\n", reg_data2); + + if ((reg_data & MAX77705_BATP_OK) || !(reg_data2 & MAX77705_BATP_DTLS)) + *val = true; + else + *val = false; + + return 0; +} + +static int max77705_get_charge_type(struct max77705_charger_data *charger, int *val) +{ + struct regmap *regmap = charger->regmap; + unsigned int reg_data; + + regmap_read(regmap, MAX77705_CHG_REG_CNFG_09, ®_data); + if (!MAX77705_CHARGER_CHG_CHARGING(reg_data)) { + *val = POWER_SUPPLY_CHARGE_TYPE_NONE; + return 0; + } + + regmap_read(regmap, MAX77705_CHG_REG_DETAILS_01, ®_data); + reg_data &= MAX77705_CHG_DTLS; + + switch (reg_data) { + case 0x0: + case MAX77705_CHARGER_CONSTANT_CURRENT: + case MAX77705_CHARGER_CONSTANT_VOLTAGE: + *val = POWER_SUPPLY_CHARGE_TYPE_FAST; + return 0; + default: + *val = POWER_SUPPLY_CHARGE_TYPE_NONE; + return 0; + } + + return 0; +} + +static int max77705_get_status(struct max77705_charger_data *charger, int *val) +{ + struct regmap *regmap = charger->regmap; + unsigned int reg_data; + + regmap_read(regmap, MAX77705_CHG_REG_CNFG_09, ®_data); + if (!MAX77705_CHARGER_CHG_CHARGING(reg_data)) { + *val = POWER_SUPPLY_CHARGE_TYPE_NONE; + return 0; + } + + regmap_read(regmap, MAX77705_CHG_REG_DETAILS_01, ®_data); + reg_data &= MAX77705_CHG_DTLS; + + switch (reg_data) { + case 0x0: + case MAX77705_CHARGER_CONSTANT_CURRENT: + case MAX77705_CHARGER_CONSTANT_VOLTAGE: + *val = POWER_SUPPLY_STATUS_CHARGING; + return 0; + case MAX77705_CHARGER_END_OF_CHARGE: + case MAX77705_CHARGER_DONE: + *val = POWER_SUPPLY_STATUS_FULL; + return 0; + // those values hard coded as in vendor kernel, because of + // failure to determine it's actual meaning. + case 0x05: + case 0x06: + case 0x07: + *val = POWER_SUPPLY_STATUS_NOT_CHARGING; + return 0; + case 0x08: + case 0xA: + case 0xB: + *val = POWER_SUPPLY_STATUS_DISCHARGING; + return 0; + default: + *val = POWER_SUPPLY_STATUS_UNKNOWN; + return 0; + } + + return 0; +} + +static int max77705_get_vbus_state(struct regmap *regmap, int *value) +{ + int ret; + unsigned int charge_dtls; + + ret = regmap_read(regmap, MAX77705_CHG_REG_DETAILS_00, &charge_dtls); + if (ret) + return ret; + + charge_dtls = ((charge_dtls & MAX77705_CHGIN_DTLS) >> + MAX77705_CHGIN_DTLS_SHIFT); + + switch (charge_dtls) { + case 0x00: + *value = POWER_SUPPLY_HEALTH_UNDERVOLTAGE; + break; + case 0x01: + *value = POWER_SUPPLY_HEALTH_UNDERVOLTAGE; + break; + case 0x02: + *value = POWER_SUPPLY_HEALTH_OVERVOLTAGE; + break; + case 0x03: + *value = POWER_SUPPLY_HEALTH_GOOD; + break; + default: + return 0; + } + return 0; +} + +static int max77705_get_battery_health(struct max77705_charger_data *charger, + int *value) +{ + struct regmap *regmap = charger->regmap; + unsigned int bat_dtls; + + regmap_read(regmap, MAX77705_CHG_REG_DETAILS_01, &bat_dtls); + bat_dtls = ((bat_dtls & MAX77705_BAT_DTLS) >> MAX77705_BAT_DTLS_SHIFT); + + switch (bat_dtls) { + case MAX77705_BATTERY_NOBAT: + dev_dbg(charger->dev, "%s: No battery and the charger is suspended\n", + __func__); + *value = POWER_SUPPLY_HEALTH_NO_BATTERY; + break; + case MAX77705_BATTERY_PREQUALIFICATION: + dev_dbg(charger->dev, "%s: battery is okay but its voltage is low(~VPQLB)\n", + __func__); + break; + case MAX77705_BATTERY_DEAD: + dev_dbg(charger->dev, "%s: battery dead\n", __func__); + *value = POWER_SUPPLY_HEALTH_DEAD; + break; + case MAX77705_BATTERY_GOOD: + case MAX77705_BATTERY_LOWVOLTAGE: + *value = POWER_SUPPLY_HEALTH_GOOD; + break; + case MAX77705_BATTERY_OVERVOLTAGE: + dev_dbg(charger->dev, "%s: battery ovp\n", __func__); + *value = POWER_SUPPLY_HEALTH_OVERVOLTAGE; + break; + default: + dev_dbg(charger->dev, "%s: battery unknown\n", __func__); + *value = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE; + break; + } + + return 0; +} + +static int max77705_get_health(struct max77705_charger_data *charger, int *val) +{ + struct regmap *regmap = charger->regmap; + int ret, is_online = 0; + + ret = max77705_get_online(regmap, &is_online); + if (ret) + return ret; + if (is_online) { + ret = max77705_get_vbus_state(regmap, val); + if (ret || (*val != POWER_SUPPLY_HEALTH_GOOD)) + return ret; + } + return max77705_get_battery_health(charger, val); +} + +static int max77705_get_input_current(struct max77705_charger_data *charger, + int *val) +{ + unsigned int reg_data; + int get_current = 0; + struct regmap *regmap = charger->regmap; + + regmap_read(regmap, + MAX77705_CHG_REG_CNFG_09, ®_data); + + reg_data &= MAX77705_CHG_CHGIN_LIM_MASK; + + if (reg_data <= 3) + get_current = 100; + else if (reg_data >= MAX77705_CHG_CHGIN_LIM_MASK) + get_current = MAX77705_CURRENT_CHGIN_MAX; + else + get_current = (reg_data + 1) * 25; + + *val = get_current; + + return 0; +} + +static int max77705_get_charge_current(struct max77705_charger_data *charger, + int *val) +{ + unsigned int reg_data; + struct regmap *regmap = charger->regmap; + + + regmap_read(regmap, MAX77705_CHG_REG_CNFG_02, ®_data); + reg_data &= MAX77705_CHG_CC; + + *val = reg_data <= 0x2 ? 100 : reg_data * 50; + + return 0; +} + +static int max77705_set_float_voltage(struct max77705_charger_data *charger, + int float_voltage) +{ + int float_voltage_mv; + unsigned int reg_data = 0; + struct regmap *regmap = charger->regmap; + + float_voltage_mv = float_voltage / 1000; + reg_data = float_voltage_mv <= 4000 ? 0x0 : + float_voltage_mv >= 4500 ? 0x23 : + (float_voltage_mv <= 4200) ? (float_voltage_mv - 4000) / 50 : + (((float_voltage_mv - 4200) / 10) + 0x04); + + return regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_04, + MAX77705_CHG_CV_PRM_MASK, + (reg_data << MAX77705_CHG_CV_PRM_SHIFT)); +} + +static int max77705_get_float_voltage(struct max77705_charger_data *charger, + int *val) +{ + unsigned int reg_data = 0; + struct regmap *regmap = charger->regmap; + + regmap_read(regmap, MAX77705_CHG_REG_CNFG_04, ®_data); + reg_data &= MAX77705_CHG_PRM_MASK; + *val = reg_data <= 0x04 ? reg_data * 50 + 4000 : + (reg_data - 4) * 10 + 4200; + + return 0; +} + +static int max77705_chg_get_property(struct power_supply *psy, + enum power_supply_property psp, + union power_supply_propval *val) +{ + struct max77705_charger_data *charger = power_supply_get_drvdata(psy); + struct regmap *regmap = charger->regmap; + + switch (psp) { + case POWER_SUPPLY_PROP_ONLINE: + return max77705_get_online(regmap, &val->intval); + case POWER_SUPPLY_PROP_PRESENT: + return max77705_check_battery(charger, &val->intval); + case POWER_SUPPLY_PROP_STATUS: + return max77705_get_status(charger, &val->intval); + case POWER_SUPPLY_PROP_CHARGE_TYPE: + return max77705_get_charge_type(charger, &val->intval); + case POWER_SUPPLY_PROP_HEALTH: + return max77705_get_health(charger, &val->intval); + case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT: + return max77705_get_input_current(charger, &val->intval); + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: + return max77705_get_charge_current(charger, &val->intval); + case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: + return max77705_get_float_voltage(charger, &val->intval); + case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: + val->intval = charger->bat_info->voltage_max_design_uv; + break; + case POWER_SUPPLY_PROP_MODEL_NAME: + val->strval = max77705_charger_model; + break; + case POWER_SUPPLY_PROP_MANUFACTURER: + val->strval = max77705_charger_manufacturer; + break; + default: + return -EINVAL; + } + return 0; +} + +static const struct power_supply_desc max77705_charger_psy_desc = { + .name = "max77705-charger", + .type = POWER_SUPPLY_TYPE_USB, + .properties = max77705_charger_props, + .num_properties = ARRAY_SIZE(max77705_charger_props), + .get_property = max77705_chg_get_property, +}; + +static void max77705_chgin_isr_work(struct work_struct *work) +{ + struct max77705_charger_data *charger = + container_of(work, struct max77705_charger_data, chgin_work); + power_supply_changed(charger->psy_chg); +} + +static void max77705_charger_initialize(struct max77705_charger_data *chg) +{ + u8 reg_data; + struct power_supply_battery_info *info; + struct regmap *regmap = chg->regmap; + + if (power_supply_get_battery_info(chg->psy_chg, &info) < 0) + return; + + chg->bat_info = info; + + // unlock charger setting protect + // slowest LX slope + reg_data = MAX77705_CHGPROT_MASK | MAX77705_SLOWEST_LX_SLOPE; + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_06, reg_data, + reg_data); + + // fast charge timer disable + // restart threshold disable + // pre-qual charge disable + reg_data = (MAX77705_FCHGTIME_DISABLE << MAX77705_FCHGTIME_SHIFT) | + (MAX77705_CHG_RSTRT_DISABLE << MAX77705_CHG_RSTRT_SHIFT) | + (MAX77705_CHG_PQEN_DISABLE << MAX77705_PQEN_SHIFT); + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_01, + (MAX77705_FCHGTIME_MASK | + MAX77705_CHG_RSTRT_MASK | + MAX77705_PQEN_MASK), + reg_data); + + // OTG off(UNO on), boost off + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_00, + MAX77705_OTG_CTRL, 0); + + // charge current 450mA(default) + // otg current limit 900mA + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_02, + MAX77705_OTG_ILIM_MASK, + MAX77705_OTG_ILIM_900 << MAX77705_OTG_ILIM_SHIFT); + + // BAT to SYS OCP 4.80A + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_05, + MAX77705_REG_B2SOVRC_MASK, + MAX77705_B2SOVRC_4_8A << MAX77705_REG_B2SOVRC_SHIFT); + // top off current 150mA + // top off timer 30min + reg_data = (MAX77705_TO_ITH_150MA << MAX77705_TO_ITH_SHIFT) | + (MAX77705_TO_TIME_30M << MAX77705_TO_TIME_SHIFT) | + (MAX77705_SYS_TRACK_DISABLE << MAX77705_SYS_TRACK_DIS_SHIFT); + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_03, + (MAX77705_TO_ITH_MASK | + MAX77705_TO_TIME_MASK | + MAX77705_SYS_TRACK_DIS_MASK), reg_data); + + // cv voltage 4.2V or 4.35V + // MINVSYS 3.6V(default) + if (info->voltage_max_design_uv < 0) { + dev_warn(chg->dev, "missing battery:voltage-max-design-microvolt\n"); + max77705_set_float_voltage(chg, 4200000); + } else { + max77705_set_float_voltage(chg, info->voltage_max_design_uv); + } + + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_12, + MAX77705_VCHGIN_REG_MASK, MAX77705_VCHGIN_4_5); + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_12, + MAX77705_WCIN_REG_MASK, MAX77705_WCIN_4_5); + + // Watchdog timer + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_00, + MAX77705_WDTEN_MASK, 0); + + // Active Discharge Enable + regmap_update_bits(regmap, MAX77705_PMIC_REG_MAINCTRL1, 1, 1); + + // VBYPSET=5.0V + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_11, MAX77705_VBYPSET_MASK, 0); + + // Switching Frequency : 1.5MHz + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_08, MAX77705_REG_FSW_MASK, + (MAX77705_CHG_FSW_1_5MHz << MAX77705_REG_FSW_SHIFT)); + + // Auto skip mode + regmap_update_bits(regmap, MAX77705_CHG_REG_CNFG_12, MAX77705_REG_DISKIP_MASK, + (MAX77705_AUTO_SKIP << MAX77705_REG_DISKIP_SHIFT)); +} + +static int max77705_charger_probe(struct platform_device *pdev) +{ + struct power_supply_config pscfg = {}; + struct max77693_dev *max77705; + struct max77705_charger_data *chg; + struct device *dev, *parent; + struct regmap_irq_chip_data *irq_data; + int ret; + + dev = &pdev->dev; + parent = dev->parent; + max77705 = dev_get_drvdata(parent); + + chg = devm_kzalloc(dev, sizeof(*chg), GFP_KERNEL); + if (!chg) + return -ENOMEM; + + platform_set_drvdata(pdev, chg); + + chg->regmap = max77705->regmap_chg; + if (!chg->regmap) + return -ENODEV; + + chg->dev = dev; + + max77705_charger_irq_chip.irq_drv_data = chg; + ret = devm_regmap_add_irq_chip(chg->dev, chg->regmap, max77705->irq, + IRQF_ONESHOT | IRQF_SHARED, 0, + &max77705_charger_irq_chip, + &irq_data); + if (ret) { + dev_err(dev, "failed to add irq chip: %d\n", ret); + return ret; + } + + ret = regmap_update_bits(chg->regmap, + MAX77705_CHG_REG_INT_MASK, + MAX77705_CHGIN_IM, 0); + + if (ret) + return ret; + + chg->wqueue = create_singlethread_workqueue(dev_name(dev)); + if (IS_ERR(chg->wqueue)) { + dev_err(dev, "failed to create workqueue\n"); + return PTR_ERR(chg->wqueue); + } + INIT_WORK(&chg->chgin_work, max77705_chgin_isr_work); + + pscfg.of_node = dev->of_node; + pscfg.drv_data = chg; + + chg->psy_chg = devm_power_supply_register(dev, &max77705_charger_psy_desc, + &pscfg); + if (IS_ERR(chg->psy_chg)) + return PTR_ERR(chg->psy_chg); + + max77705_charger_initialize(chg); + + return max77705_charger_enable(chg); +} + +static void max77705_charger_remove(struct platform_device *pdev) +{ + struct max77705_charger_data *chg = platform_get_drvdata(pdev); + + max77705_charger_disable(chg); +} + +static const struct of_device_id max77705_charger_of_match[] = { + { .compatible = "maxim,max77705-charger" }, + { } +}; +MODULE_DEVICE_TABLE(of, max77705_charger_of_match); + +static struct platform_driver max77705_charger_driver = { + .driver = { + .name = "max77705-charger", + .of_match_table = max77705_charger_of_match, + }, + .probe = max77705_charger_probe, + .remove_new = max77705_charger_remove, +}; +module_platform_driver(max77705_charger_driver); + +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_DESCRIPTION("Maxim 77705 charger driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/mfd/max77705_charger.h b/include/linux/mfd/max77705_charger.h new file mode 100644 index 000000000000..72614d7575a3 --- /dev/null +++ b/include/linux/mfd/max77705_charger.h @@ -0,0 +1,215 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +// +// Maxim MAX77705 definitions. +// +// Copyright (C) 2015 Samsung Electronics, Inc. +// Copyright (C) 2024 Dzmitry Sankouski + +#ifndef __MAX77705_CHARGER_H +#define __MAX77705_CHARGER_H __FILE__ + +// MAX77705_CHG_REG_CHG_INT +#define MAX77705_BYP_I BIT(0) +#define MAX77705_INP_LIMIT_I BIT(1) +#define MAX77705_BATP_I BIT(2) +#define MAX77705_BAT_I BIT(3) +#define MAX77705_CHG_I BIT(4) +#define MAX77705_WCIN_I BIT(5) +#define MAX77705_CHGIN_I BIT(6) +#define MAX77705_AICL_I BIT(7) + +// MAX77705_CHG_REG_CHG_INT_MASK +#define MAX77705_BYP_IM BIT(0) +#define MAX77705_INP_LIMIT_IM BIT(1) +#define MAX77705_BATP_IM BIT(2) +#define MAX77705_BAT_IM BIT(3) +#define MAX77705_CHG_IM BIT(4) +#define MAX77705_WCIN_IM BIT(5) +#define MAX77705_CHGIN_IM BIT(6) +#define MAX77705_AICL_IM BIT(7) + +// MAX77705_CHG_REG_CHG_INT_OK +#define MAX77705_BYP_OK BIT(0) +#define MAX77705_DISQBAT_OK BIT(1) +#define MAX77705_BATP_OK BIT(2) +#define MAX77705_BAT_OK BIT(3) +#define MAX77705_CHG_OK BIT(4) +#define MAX77705_WCIN_OK BIT(5) +#define MAX77705_CHGIN_OK BIT(6) +#define MAX77705_AICL_OK BIT(7) + +// MAX77705_CHG_REG_DETAILS_00 +#define MAX77705_BATP_DTLS BIT(0) +#define MAX77705_WCIN_DTLS GENMASK(4, 3) +#define MAX77705_WCIN_DTLS_SHIFT 3 +#define MAX77705_CHGIN_DTLS GENMASK(6, 5) +#define MAX77705_CHGIN_DTLS_SHIFT 5 + +// MAX77705_CHG_REG_DETAILS_01 +#define MAX77705_CHG_DTLS GENMASK(3, 0) +#define MAX77705_CHG_DTLS_SHIFT 0 +#define MAX77705_BAT_DTLS GENMASK(6, 4) +#define MAX77705_BAT_DTLS_SHIFT 4 + +// MAX77705_CHG_REG_DETAILS_02 +#define MAX77705_BYP_DTLS GENMASK(3, 0) +#define MAX77705_BYP_DTLS_SHIFT 0 + +// MAX77705_CHG_REG_CNFG_00 +#define MAX77705_CHG_SHIFT 0 +#define MAX77705_UNO_SHIFT 1 +#define MAX77705_OTG_SHIFT 1 +#define MAX77705_BUCK_SHIFT 2 +#define MAX77705_BOOST_SHIFT 3 +#define MAX77705_WDTEN_SHIFT 4 +#define MAX77705_MODE_MASK GENMASK(3, 0) +#define MAX77705_CHG_MASK BIT(MAX77705_CHG_SHIFT) +#define MAX77705_UNO_MASK BIT(MAX77705_UNO_SHIFT) +#define MAX77705_OTG_MASK BIT(MAX77705_OTG_SHIFT) +#define MAX77705_BUCK_MASK BIT(MAX77705_BUCK_SHIFT) +#define MAX77705_BOOST_MASK BIT(MAX77705_BOOST_SHIFT) +#define MAX77705_WDTEN_MASK BIT(MAX77705_WDTEN_SHIFT) +#define MAX77705_UNO_CTRL (MAX77705_UNO_MASK | MAX77705_BOOST_MASK) +#define MAX77705_OTG_CTRL (MAX77705_OTG_MASK | MAX77705_BOOST_MASK) + +// MAX77705_CHG_REG_CNFG_01 +#define MAX77705_FCHGTIME_SHIFT 0 +#define MAX77705_FCHGTIME_MASK GENMASK(2, 0) +#define MAX77705_CHG_RSTRT_SHIFT 4 +#define MAX77705_CHG_RSTRT_MASK GENMASK(5, 4) +#define MAX77705_FCHGTIME_DISABLE 0 +#define MAX77705_CHG_RSTRT_DISABLE 0x3 + +#define MAX77705_PQEN_SHIFT 7 +#define MAX77705_PQEN_MASK BIT(7) +#define MAX77705_CHG_PQEN_DISABLE 0 +#define MAX77705_CHG_PQEN_ENABLE 1 + +// MAX77705_CHG_REG_CNFG_02 +#define MAX77705_OTG_ILIM_SHIFT 6 +#define MAX77705_OTG_ILIM_MASK GENMASK(7, 6) +#define MAX77705_OTG_ILIM_500 0 +#define MAX77705_OTG_ILIM_900 1 +#define MAX77705_OTG_ILIM_1200 2 +#define MAX77705_OTG_ILIM_1500 3 +#define MAX77705_CHG_CC GENMASK(5, 0) + +// MAX77705_CHG_REG_CNFG_03 +#define MAX77705_TO_ITH_SHIFT 0 +#define MAX77705_TO_ITH_MASK GENMASK(2, 0) +#define MAX77705_TO_TIME_SHIFT 3 +#define MAX77705_TO_TIME_MASK GENMASK(5, 3) +#define MAX77705_SYS_TRACK_DIS_SHIFT 7 +#define MAX77705_SYS_TRACK_DIS_MASK BIT(7) +#define MAX77705_TO_ITH_150MA 0 +#define MAX77705_TO_TIME_30M 3 +#define MAX77705_SYS_TRACK_ENABLE 0 +#define MAX77705_SYS_TRACK_DISABLE 1 + +// MAX77705_CHG_REG_CNFG_04 +#define MAX77705_CHG_MINVSYS_SHIFT 6 +#define MAX77705_CHG_MINVSYS_MASK GENMASK(7, 6) +#define MAX77705_CHG_PRM_SHIFT 0 +#define MAX77705_CHG_PRM_MASK GENMASK(5, 0) + +#define MAX77705_CHG_CV_PRM_SHIFT 0 +#define MAX77705_CHG_CV_PRM_MASK GENMASK(5, 0) + +// MAX77705_CHG_REG_CNFG_05 +#define MAX77705_REG_B2SOVRC_SHIFT 0 +#define MAX77705_REG_B2SOVRC_MASK GENMASK(3, 0) +#define MAX77705_B2SOVRC_DISABLE 0 +#define MAX77705_B2SOVRC_4_5A 6 +#define MAX77705_B2SOVRC_4_8A 8 +#define MAX77705_B2SOVRC_5_0A 9 + +// MAX77705_CHG_CNFG_06 +#define MAX77705_WDTCLR_SHIFT 0 +#define MAX77705_WDTCLR_MASK GENMASK(1, 0) +#define MAX77705_WDTCLR 1 +#define MAX77705_CHGPROT_MASK GENMASK(3, 2) +#define MAX77705_CHGPROT_UNLOCKED GENMASK(3, 2) +#define MAX77705_SLOWEST_LX_SLOPE GENMASK(6, 5) + +// MAX77705_CHG_REG_CNFG_07 +#define MAX77705_CHG_FMBST 4 +#define MAX77705_REG_FMBST_SHIFT 2 +#define MAX77705_REG_FMBST_MASK BIT(MAX77705_REG_FMBST_SHIFT) +#define MAX77705_REG_FGSRC_SHIFT 1 +#define MAX77705_REG_FGSRC_MASK BIT(MAX77705_REG_FGSRC_SHIFT) + +// MAX77705_CHG_REG_CNFG_08 +#define MAX77705_REG_FSW_SHIFT 0 +#define MAX77705_REG_FSW_MASK GENMASK(1, 0) +#define MAX77705_CHG_FSW_3MHz 0 +#define MAX77705_CHG_FSW_2MHz 1 +#define MAX77705_CHG_FSW_1_5MHz 2 + +// MAX77705_CHG_REG_CNFG_09 +#define MAX77705_CHG_CHGIN_LIM_MASK GENMASK(6, 0) +#define MAX77705_CHG_EN_MASK BIT(7) +#define MAX77705_CHG_DISABLE 0 +#define MAX77705_CHARGER_CHG_CHARGING(_reg) \ + (((_reg) & MAX77705_CHG_EN_MASK) > 1) + + +// MAX77705_CHG_REG_CNFG_10 +#define MAX77705_CHG_WCIN_LIM GENMASK(5, 0) + +// MAX77705_CHG_REG_CNFG_11 +#define MAX77705_VBYPSET_SHIFT 0 +#define MAX77705_VBYPSET_MASK GENMASK(6, 0) + +// MAX77705_CHG_REG_CNFG_12 +#define MAX77705_CHGINSEL_SHIFT 5 +#define MAX77705_CHGINSEL_MASK BIT(MAX77705_CHGINSEL_SHIFT) +#define MAX77705_WCINSEL_SHIFT 6 +#define MAX77705_WCINSEL_MASK BIT(MAX77705_WCINSEL_SHIFT) +#define MAX77705_VCHGIN_REG_MASK GENMASK(4, 3) +#define MAX77705_WCIN_REG_MASK GENMASK(2, 1) +#define MAX77705_REG_DISKIP_SHIFT 0 +#define MAX77705_REG_DISKIP_MASK BIT(MAX77705_REG_DISKIP_SHIFT) +// REG=4.5V, UVLO=4.7V +#define MAX77705_VCHGIN_4_5 0 +// REG=4.5V, UVLO=4.7V +#define MAX77705_WCIN_4_5 0 +#define MAX77705_DISABLE_SKIP 1 +#define MAX77705_AUTO_SKIP 0 + +// mA +#define MAX77705_CURRENT_STEP 25 +#define MAX77705_CURRENT_WCIN_MAX 1600 +#define MAX77705_CURRENT_CHGIN_MAX 3200 + +/* Convert current in mA to corresponding CNFG09 value */ +inline u8 max77705_convert_ma_to_chgin_ilim_value(unsigned int cur) +{ + if (cur < MAX77705_CURRENT_STEP) + return 0; + if (cur < MAX77705_CURRENT_CHGIN_MAX) + return (cur / MAX77705_CURRENT_STEP) - 1; + else + return (MAX77705_CURRENT_CHGIN_MAX / MAX77705_CURRENT_STEP) - 1; +} + +/* Convert current in mA to corresponding CNFG10 value */ +inline u8 max77705_convert_ma_to_wcin_ilim_value(unsigned int cur) +{ + if (cur < MAX77705_CURRENT_STEP) + return 0; + if (cur < MAX77705_CURRENT_WCIN_MAX) + return (cur / MAX77705_CURRENT_STEP) - 1; + else + return (MAX77705_CURRENT_WCIN_MAX / MAX77705_CURRENT_STEP) - 1; +} + +struct max77705_charger_data { + struct device *dev; + struct regmap *regmap; + struct power_supply_battery_info *bat_info; + struct workqueue_struct *wqueue; + struct work_struct chgin_work; + struct power_supply *psy_chg; +}; + +#endif // __MAX77705_CHARGER_H From patchwork Fri Sep 13 15:07: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: 828677 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.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 8D60B13C9A2; Fri, 13 Sep 2024 15:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240128; cv=none; b=OBn+k7G97zddafSNlnohI8/xapl/NZX0OCIDrxn9vSDkuVsZY7XTfLJqt30nRAbPXqF8POjcCoI/3j/3/itWHaVzws1FacMeOFazGHJY4NexMOCqJLAdC54vuOwrDKQNOc87YNOoRJA0RLCEa2Dr77G6c756ZPZ5M+X+yPMT3q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240128; c=relaxed/simple; bh=p+WSYslVsxknZs6ezCVMZEXQSewZUJ6+jj6SYxMX/RQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mxRjiard7tbSwj8ubLAzLCwPgEjCmMkQ/Ys2h/vcfg4j4ZFyxUJr7BWWkOd92Exhn6wbQCsawAzvd0b+ulJghCx3rLqRQqEPRIe38lBbos/l4mYpzuw95+qrzECoWCaG5HhEYBQvaZE9bF2V4CzdCtay+NtFjNYPBagNozR43N0= 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=FqlNIIHM; arc=none smtp.client-ip=209.85.218.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="FqlNIIHM" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a8a7903cb7dso60308166b.3; Fri, 13 Sep 2024 08:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240124; x=1726844924; 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=pupmYNFojwa4AS9hnAothqKw0lYUAY5hOWiwFnl9YiU=; b=FqlNIIHM4XlJYpm9Jxek9ehqnWFKaJyPGYDTGhYDaxmXnLANA5q7kjvtDY6azUOzSk nmxb0Jufr5Oz615Ekmt+8VjWGXUOqzSY3axxGIOkPmSgze4ssl6z07W2iwsXpKMyE68r Pu1PjZ3rR6+9rlXLXt6LdkcpWH7ePG0cFGzbl+KlXNO/8tyy9U9jzLbqrOlpdtVmUNfI 5PzHMAnx9w/eesdk+JGOhPSYpdo97FhTLp9SC1Hpa7h906pld04kSlpgr4qFbMRIPmWE 8vkRzT55f6Qka/6OG0sw03RnQ3NARjDc/FLiEVDCNyB6GAkZxUmtBeF6A+FnF+xZcLYs lJow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240124; x=1726844924; 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=pupmYNFojwa4AS9hnAothqKw0lYUAY5hOWiwFnl9YiU=; b=BO/QV4POMnx74ixOK/abiO87kxYTzH3gKN4DvnLic9Jhps/HITo1yfJiWAAAEi3PjL rxsvcyPdKHBi1sSoJ7dXfZwwJVU57yrEj07aPyoX5dcnQvifx0dPlnLLuDsa8IzBAwnH laSjnBSF+96icz51cetP1PwV8eGoVqxjAsHKpfeDEf7c8iwRBKWr7tEnFhtNwDu7B8XP e5CZM7DvSHSa7ykYacSr7ZkxnQrwmrJGmbC0nFv26ETAhGBIIRcmQyS1JnKLQ3I0We5z L/jNNjuI1siVq1tifzJB8XBcjcqJK0N2qOWx7B5776g/aBZ/7IZPBN6kjR8tkbdEPc4s PJjg== X-Forwarded-Encrypted: i=1; AJvYcCURbIlyspscZCPXXgu7Qh43OPjaea9NK/DKuiIgSxrMkKPa3mspflQITNP8RNgXSy8BGa4/GQJI03eeeLADFg==@vger.kernel.org, AJvYcCVaZYqE2iyDedDr1qhPYWm19TfGMwljXu/b9kmWmy54FWZSz442eDXQ5Pv0whQspAfsHd/7eUJ1QbN/@vger.kernel.org, AJvYcCW5L7PCayNzsngEiz1yP1MriTgV/CIN8Qh4tS63skH81gB/1jqfw7Yn5fZT4wVPTjE+Gggk6WC6HZ4BOA==@vger.kernel.org, AJvYcCWcCJfDUbNlxaYsen4RMaztFXRQS9mJaU9ku1h51e3kj3w22Pa95+hX8nTp3+h9nCyO0IYIL9FzOzm/CjjGa/auNa4=@vger.kernel.org, AJvYcCWx9egTSdVtB5tRUjqMP4xCODmGLhueET052l/rf54nSroaykOKOwUbQH7jx88nUmnN+jiyyO5YSoXurzTq@vger.kernel.org, AJvYcCX9MQXgECu5AXy7yKUIkrSHMEwOl+ioMXcC3YxLWfbRyPkZ6eGi0hxpENbvFa54319JnbkJ+qJQgxll@vger.kernel.org, AJvYcCXAGVpvquCv7/9Qv+fZL6Sa+6eT4tXq9R+RXCaARhTxGESmcZCO1nUbDbFG87Ao5qaktOD6gay8vNvM@vger.kernel.org, AJvYcCXq1XIt96Elb6rgL2KpgnVVqRrOl7P4Zn7X3UssitswASBCT54BWnJd1OZn4P12q/ly3IRlOBb/TwlBRRs=@vger.kernel.org X-Gm-Message-State: AOJu0YwgNcrS02rPXcl87tBeDT6osjceayk9XeYMe02JxuH7/UCxD7rY zbPisc/Ylk8URo2y9ljP2AEnfwEUODRdYiFyAGwhwLd91rf/XYrDRo/E8g== X-Google-Smtp-Source: AGHT+IEwbSvNiugjatMh5BW7pw654QzCKiuKr8XxbLHe0e9IwPRYy9qAEQel0IXS+Gtge68TspDb6g== X-Received: by 2002:a05:6402:1e88:b0:5c4:235a:e66 with SMTP id 4fb4d7f45d1cf-5c4235a119amr1712431a12.34.1726240124417; Fri, 13 Sep 2024 08:08:44 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:43 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:55 +0300 Subject: [PATCH v4 12/27] 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: <20240913-starqltechn_integration_upstream-v4-12-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=14886; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=p+WSYslVsxknZs6ezCVMZEXQSewZUJ6+jj6SYxMX/RQ=; b=94tpNsMnOvVyHJE97Q0jZ//9/tTO1wnWXgUdGLy2Yw50uE3n/30goPk3ZKiHeeEdsNpW7TCbX tzHZMdgRaGkBbPNOWjbPF0sR6MUuK4B/r31+uyv3CWk7WFVhnSvNn74 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 --- Changes for V4: - rework driver from scratch - change word delimiters in filenames to "_" - remove debugfs code - cleanup header --- drivers/power/supply/Kconfig | 7 + drivers/power/supply/Makefile | 1 + drivers/power/supply/max77705_fuel_gauge.c | 348 +++++++++++++++++++++++++++++ include/linux/power/max77705_fuelgauge.h | 65 ++++++ 4 files changed, 421 insertions(+) diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig index fe84d2004f57..0b2da9d88a80 100644 --- a/drivers/power/supply/Kconfig +++ b/drivers/power/supply/Kconfig @@ -579,6 +579,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 daa9228fa04b..b949600a6207 100644 --- a/drivers/power/supply/Makefile +++ b/drivers/power/supply/Makefile @@ -80,6 +80,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_fuel_gauge.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_fuel_gauge.c b/drivers/power/supply/max77705_fuel_gauge.c new file mode 100644 index 000000000000..90d695bfdf9f --- /dev/null +++ b/drivers/power/supply/max77705_fuel_gauge.c @@ -0,0 +1,348 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2024 Dzmitry Sankouski +// +// Fuel gauge driver for MAXIM 77705 charger/power-supply. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *max77705_fuelgauge_model = "max77705"; +static const char *max77705_fuelgauge_manufacturer = "Maxim Integrated"; + +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_reg(struct max77705_fuelgauge_data *fuelgauge, + unsigned int reg, unsigned int *val) +{ + struct regmap *regmap = fuelgauge->regmap; + u8 data[2]; + int ret; + + ret = regmap_noinc_read(regmap, reg, data, sizeof(data)); + if (ret < 0) + return ret; + + *val = (data[1] << 8) + data[0]; + + return 0; +} + +static int max77705_fg_read_temp(struct max77705_fuelgauge_data *fuelgauge, + int *val) +{ + struct regmap *regmap = fuelgauge->regmap; + u8 data[2] = { 0, 0 }; + int ret, temperature = 0; + + ret = regmap_noinc_read(regmap, TEMPERATURE_REG, data, sizeof(data)); + if (ret < 0) + return ret; + + if (data[1] & BIT(7)) + temperature = ((~(data[1])) & 0xFF) + 1; + else + temperature = data[1] & 0x7f; + + temperature *= 10; + temperature += data[0] * 10 / 256; + *val = temperature; + + return 0; +} + +static int max77705_fg_check_battery_present(struct max77705_fuelgauge_data + *fuelgauge, int *val) +{ + struct regmap *regmap = fuelgauge->regmap; + u8 status_data[2]; + int ret; + + ret = regmap_noinc_read(regmap, STATUS_REG, status_data, sizeof(status_data)); + if (ret < 0) + return ret; + + *val = !(status_data[0] & MAX77705_BAT_ABSENT_MASK); + + return 0; +} + +static int max77705_battery_get_status(struct max77705_fuelgauge_data *fuelgauge, + int *val) +{ + int current_now; + int am_i_supplied; + int ret; + unsigned int soc_rep; + + 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 { + *val = POWER_SUPPLY_STATUS_CHARGING; + return 0; + } + } + ret = max77705_fg_read_reg(fuelgauge, SOCREP_REG, &soc_rep); + if (ret) + return ret; + + if (soc_rep < 100) { + ret = max77705_fg_read_reg(fuelgauge, CURRENT_REG, ¤t_now); + if (ret) + return ret; + + if (current_now > 0) + *val = POWER_SUPPLY_STATUS_CHARGING; + else if (current_now < 0) + *val = POWER_SUPPLY_STATUS_DISCHARGING; + else + *val = POWER_SUPPLY_STATUS_NOT_CHARGING; + } else { + *val = POWER_SUPPLY_STATUS_FULL; + } + + return 0; +} + +static void max77705_unit_adjustment(struct max77705_fuelgauge_data *fuelgauge, + enum power_supply_property psp, + union power_supply_propval *val) +{ + const unsigned int base_unit_conversion = 1000; + + switch (psp) { + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + case POWER_SUPPLY_PROP_VOLTAGE_OCV: + case POWER_SUPPLY_PROP_VOLTAGE_AVG: + val->intval = max77705_fg_vs_convert(val->intval); + break; + case POWER_SUPPLY_PROP_CURRENT_NOW: + case POWER_SUPPLY_PROP_CURRENT_AVG: + val->intval = max77705_fg_cs_convert(val->intval, + fuelgauge->rsense_conductance); + break; + case POWER_SUPPLY_PROP_CHARGE_NOW: + case POWER_SUPPLY_PROP_CHARGE_FULL: + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + val->intval *= base_unit_conversion; + break; + case POWER_SUPPLY_PROP_CAPACITY: + val->intval = min(val->intval, 100); + break; + default: + dev_dbg(fuelgauge->dev, + "%s: no need for unit conversion %d\n", __func__, psp); + } +} + +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); + int ret; + + switch (psp) { + case POWER_SUPPLY_PROP_STATUS: + ret = max77705_battery_get_status(fuelgauge, &val->intval); + break; + case POWER_SUPPLY_PROP_PRESENT: + ret = max77705_fg_check_battery_present(fuelgauge, &val->intval); + break; + case POWER_SUPPLY_PROP_VOLTAGE_NOW: + ret = max77705_fg_read_reg(fuelgauge, VCELL_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_VOLTAGE_OCV: + ret = max77705_fg_read_reg(fuelgauge, VFOCV_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_VOLTAGE_AVG: + ret = max77705_fg_read_reg(fuelgauge, AVR_VCELL_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CURRENT_NOW: + ret = max77705_fg_read_reg(fuelgauge, CURRENT_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CURRENT_AVG: + ret = max77705_fg_read_reg(fuelgauge, AVG_CURRENT_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CHARGE_NOW: + ret = max77705_fg_read_reg(fuelgauge, REMCAP_REP_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CHARGE_FULL: + ret = max77705_fg_read_reg(fuelgauge, FULLCAP_REP_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN: + ret = max77705_fg_read_reg(fuelgauge, DESIGNCAP_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CAPACITY: + ret = max77705_fg_read_reg(fuelgauge, SOCREP_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_TEMP: + ret = max77705_fg_read_temp(fuelgauge, &val->intval); + break; + case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW: + ret = max77705_fg_read_reg(fuelgauge, TIME_TO_EMPTY_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_TIME_TO_FULL_NOW: + ret = max77705_fg_read_reg(fuelgauge, TIME_TO_FULL_REG, &val->intval); + break; + case POWER_SUPPLY_PROP_CYCLE_COUNT: + ret = max77705_fg_read_reg(fuelgauge, CYCLES_REG, &val->intval); + 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; + } + + if (ret) + return ret; + + max77705_unit_adjustment(fuelgauge, psp, val); + + return 0; +} + +static const struct power_supply_desc max77705_fg_desc = { + .name = "max77705-fuel-gauge", + .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_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; + + return regmap_noinc_write(regmap, DESIGNCAP_REG, data, sizeof(data)); +} + +static int max77705_battery_settings(struct max77705_fuelgauge_data *fuelgauge) +{ + struct power_supply_battery_info *info; + struct regmap *regmap = fuelgauge->regmap; + int ret; + + ret = power_supply_get_battery_info(fuelgauge->psy_fg, &info); + if (ret) + return ret; + + fuelgauge->bat_info = info; + + 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"); + ret = max77705_fg_set_charge_design(regmap, info->charge_full_design_uah); + } + + return ret; +} + +static int max77705_fuelgauge_parse_dt(struct max77705_fuelgauge_data + *fuelgauge) +{ + struct device *dev = fuelgauge->dev; + struct device_node *np = dev->of_node; + int ret; + unsigned int rsense; + + if (!np) { + dev_err(dev, "no fuelgauge OF node\n"); + return -EINVAL; + } + ret = of_property_read_u32(np, "shunt-resistor-micro-ohms", + &rsense); + if (ret < 0) { + dev_warn(dev, "No shunt-resistor-micro-ohms property, assume default\n"); + fuelgauge->rsense_conductance = 100; + } else + fuelgauge->rsense_conductance = 1000000 / rsense; /* rsense conductance in Ohm^-1 */ + + return 0; +} + +static int max77705_fuelgauge_probe(struct platform_device *pdev) +{ + struct max77693_dev *max77705 = dev_get_drvdata(pdev->dev.parent); + struct max77705_fuelgauge_data *fuelgauge; + struct power_supply_config fuelgauge_cfg = { }; + struct device *dev = &pdev->dev; + int ret = 0; + + fuelgauge = devm_kzalloc(dev, sizeof(*fuelgauge), GFP_KERNEL); + if (!fuelgauge) + return -ENOMEM; + + fuelgauge->dev = dev; + fuelgauge->regmap = max77705->regmap_fg; + + ret = max77705_fuelgauge_parse_dt(fuelgauge); + if (ret < 0) + return ret; + + fuelgauge_cfg.drv_data = fuelgauge; + fuelgauge_cfg.of_node = fuelgauge->dev->of_node; + + fuelgauge->psy_fg = devm_power_supply_register(&pdev->dev, + &max77705_fg_desc, + &fuelgauge_cfg); + + if (IS_ERR(fuelgauge->psy_fg)) + return PTR_ERR(fuelgauge->psy_fg); + + return max77705_battery_settings(fuelgauge); +} + +static const struct of_device_id max77705_fg_of_match[] = { + { .compatible = "maxim,max77705-fuel-gauge" }, + { } +}; +MODULE_DEVICE_TABLE(of, max77705_fg_of_match); + +static struct platform_driver max77705_fuelgauge_driver = { + .driver = { + .name = "max77705-fuel-gauge", + .of_match_table = max77705_fg_of_match, + }, + .probe = max77705_fuelgauge_probe, +}; +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..599b3fb5a7e4 --- /dev/null +++ b/include/linux/power/max77705_fuelgauge.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +// +// Copyright (C) 2024 Dzmitry Sankouski +// +// Fuel gauge driver header for MAXIM 77705 charger/power-supply. + +#ifndef __MAX77705_FUELGAUGE_H +#define __MAX77705_FUELGAUGE_H __FILE__ + +#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_REG 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_REG register +#define MAX77705_AUTO_DISCHARGE_EN_MASK BIT(9) +// STATUS_REG register +#define MAX77705_BAT_ABSENT_MASK BIT(3) + +// @brief Convert voltage register value to micro volts +// @param reg_val - register value +// @return voltage in micro Volts +inline u64 max77705_fg_vs_convert(u16 reg_val) +{ + u64 result = (u64)reg_val * MAX77705_FG_VS_ADC_RESOLUTION; + + return result / 1000; +} + +// @brief Convert current register value to micro volts +// @param reg_val - register value +// @param rsense_conductance - current sense resistor conductance in Ohm^-1 +// @return voltage in micro Volts +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 regmap *regmap; + struct power_supply *psy_fg; + struct power_supply_battery_info *bat_info; + u32 rsense_conductance; +}; + +#endif // __MAX77705_FUELGAUGE_H From patchwork Fri Sep 13 15:07:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828246 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 23D031448F2; Fri, 13 Sep 2024 15:08:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240131; cv=none; b=sepzvq6u/T+ZTIbgLNPEeLT/dAePyxVijgtxQPv7j7gy3pHZ+/33xkWx2KvWFjSdRamCXL6x7guPtBDhMlUNYybrp3lF8ihj66jqYSK70UkyvC9TzO2C8hGz7BeQboSiXCPYQbd5CKcXQHdL4ojBf/WTAFquIECheYz0z7d5T38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240131; c=relaxed/simple; bh=M+OsxN2/WpgrY2WuTXnjhSOeH+HsWUOEWmKXapd+uZI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=M4PFa0zTEe+Otmy+Bt9cHgrDxBsIsDbr6aoUCwKZEReDVWoIpcgDlNG38pV+C2swgwoV8kFRy0jOMYOAocamM2foxdj06KnaSk+U4746L5MHLKt8ge0dfE1d3n/F0BupJYFj4bYYUPmt/fdjfxQWmGaW9xeWXjDb+gk2K7DbtUk= 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=BR7Yq4Sm; arc=none smtp.client-ip=209.85.208.50 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="BR7Yq4Sm" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5c26815e174so1163712a12.0; Fri, 13 Sep 2024 08:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240127; x=1726844927; 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=ahWTGZu8xtSURP9GzlzlPy1xp3tDRlgc6c0AKCVoexk=; b=BR7Yq4SmbdXRotfVU041yLt6e0baEWihTblTsUEkoGs00Y/jEd3VuzRL3pIJVJWens YkC0vG/Ag6FTHrq175Q6xufyipS4LlXBarN3SoUyCwyWMO5Cg1NZKJYhwg4DTdDG0dtq osi0NZWl0o8wtdWfhd/0EPwsOkKGAoCuC9I8sHPn4PO3drR4SMcFcCjKTc69jyRMDULM yzTdspE4u8UxrYzaEwETFme6jiPuGmlasKvlFZAbvdhGCP7qtGNsZs3Si3kOFTdbJnGp Ggs7HTrQleQ4WXJIIdzkPmpsRvj7XEptAMhH8qjXkkTBE6SomOBfp78tUfKexHgvQtnx AHJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240127; x=1726844927; 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=ahWTGZu8xtSURP9GzlzlPy1xp3tDRlgc6c0AKCVoexk=; b=TkTJdnCTtOCBjEw5kSq/eVgQfpu86T+/yjWnrZfR5Rv2J1zkgw9XSNeEo+h5fu1Y/F PlMpBJLuu28QF7YxcbEOsXrmeqdX83ViuKj+VQl0lru6syLShyRoqTex1x1oDxPDW3PW oP69DSIylLq2kPw/NJ9xN79YMV8MuWUE/c9U/pcLajsMCm3Fpn8mGIfQHvk6pGIl9agu mCz/8AyOaHj5L72TB0NzUTramIPG39JGe2dYymaLT1gjp32T+dH/ia9cY201DnNfJ5tg CdbvlSap7IdjYiYAFg2qc9KqyvlAZJQJUvKatH1Ei0fQGVbu/G19o73yL9Q1Z3W7ylnh BhBw== X-Forwarded-Encrypted: i=1; AJvYcCUTHTJ1CibVjwisDQuoLOWL/pPzDOVPDIHJscGn4PmHN1My14OVqkTm8weotdPS1+NcwFsPYZWI1L98bA==@vger.kernel.org, AJvYcCVmMEhbPPjs6uUjKkUE4mwAAjxWCSddYd/i+P/af3Bpn1SG3911W4Tq3gOIP46qJpCiE+AQ0nAcnWM4lhY=@vger.kernel.org, AJvYcCWKN1SQEc+AWYVqBP0RtSGj8O9GA4ftMk2QOvTFz+bmfbdYox/DDtaJ1tC2LIxXpPNzSxY6dlHEsEOd@vger.kernel.org, AJvYcCWoMYW1D7bh216hIRRR0gtqqnBJDBUgkNyxtKs1HV0pRQ4jcFa1IdXnC8MPOGtKK+occXZrw932WBnm@vger.kernel.org, AJvYcCWqB/ZFVfzbF8QSvuC1Qb/wL5vI5iVhjiG3q6FwoxrQH93ktLFsxIeQJ2QlTYYi0fRKK37ukrP96rgw7QfG@vger.kernel.org, AJvYcCWqe35wF4uAIRI/crkQIB0mXnSsQo5WCGrhxtDc2yhssULhTV+1GKxzqZfV74uKO7lu8EPcaAW/WyRCn4eqRFXbR24=@vger.kernel.org, AJvYcCWvOk4d7jCyuX37/Tf4Q8OyBgn9lLv/bRE2EuzutpthkRWQJq2B/qs/g+GJmsJEl8eihY3L5boM8YYLl6SLPw==@vger.kernel.org, AJvYcCWyWObt342bdUriv+x7jaT/Mro4GjRtKYr8QtIjb97o2XSTOEsxxza+Y15Tj8zbZDmHCJM9YlTkZLBs@vger.kernel.org X-Gm-Message-State: AOJu0YykTOw+hLVX1Xsb6GTLwuPSp4gw/puX2wYcJ+FX8oJWZifpDhk1 a34oYCNusSDmHC8ElwsDn8h+gDbQg+y3BuikoJPnb9H28cVpJl0OxHl0IA== X-Google-Smtp-Source: AGHT+IGRt5AFeS3wRtD8rPkJeKt6sAW3sCB0CjqoyYMhFWR7JyO6UcA2Os0fgdDTdR2POOYyiFyO9w== X-Received: by 2002:a05:6402:909:b0:5c0:ac1d:b970 with SMTP id 4fb4d7f45d1cf-5c41e1b52f7mr2990485a12.32.1726240126941; Fri, 13 Sep 2024 08:08:46 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:46 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:56 +0300 Subject: [PATCH v4 13/27] leds: max77705: Add LEDs support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-13-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=6747; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=M+OsxN2/WpgrY2WuTXnjhSOeH+HsWUOEWmKXapd+uZI=; b=+XwhRo/u1iXBMs1CErWIPnhwhGTnk/d3aSSfPiOQyIYSkQLPEB5gIILypvPWqnaNXnD/p5ESj M6dLBFDJFlJAcCJjrrEFO3ntk+QAydPTF7qib1WS1mtz6+olo/E6rCE X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= This adds basic support for LEDs for the max77705 PMIC. Signed-off-by: Dzmitry Sankouski --- Changes in v4: - inline BLINK_(ON|OFF) macro - remove camel case - drop backwards compatibility(new driver) - drop module alias --- MAINTAINERS | 1 + drivers/leds/Kconfig | 6 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-max77705.c | 158 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 716e66bb7982..444cc855a01e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14073,6 +14073,7 @@ F: drivers/*/max14577*.c F: drivers/*/max77686*.c F: drivers/*/max77693*.c F: drivers/*/max77705*.c +F: drivers/leds/leds-max77705.c F: drivers/clk/clk-max77686.c F: drivers/extcon/extcon-max14577.c F: drivers/extcon/extcon-max77693.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index b784bb74a837..292f9f1a237e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -753,6 +753,12 @@ config LEDS_MAX77650 help LEDs driver for MAX77650 family of PMICs from Maxim Integrated. +config LEDS_MAX77705 + tristate "LED support for Maxim MAX77705 RGB" + depends on MFD_MAX77705 && LEDS_CLASS && I2C + help + LED driver for MAX77705 MFD chip from Maxim Integrated. + config LEDS_MAX8997 tristate "LED support for MAX8997 PMIC" depends on LEDS_CLASS && MFD_MAX8997 diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 18afbb5a23ee..096bf244527d 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -60,6 +60,7 @@ obj-$(CONFIG_LEDS_LP8860) += leds-lp8860.o obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o obj-$(CONFIG_LEDS_MAX5970) += leds-max5970.o obj-$(CONFIG_LEDS_MAX77650) += leds-max77650.o +obj-$(CONFIG_LEDS_MAX77705) += leds-max77705.o obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o diff --git a/drivers/leds/leds-max77705.c b/drivers/leds/leds-max77705.c new file mode 100644 index 000000000000..6190c010b039 --- /dev/null +++ b/drivers/leds/leds-max77705.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Based on leds-max77650 driver: +// Copyright (C) 2018 BayLibre SAS +// Author: Bartosz Golaszewski +// +// LED driver for MAXIM 77705 MFD. +// Copyright (C) 2024 Dzmitry Sankouski + +#include +#include +#include +#include +#include +#include + +#define MAX77705_LED_NUM_LEDS 4 +#define MAX77705_LED_EN_MASK GENMASK(1, 0) +#define MAX77705_LED_MAX_BRIGHTNESS 0xff + +struct max77705_led { + struct led_classdev cdev; + struct regmap *regmap; + unsigned int en_shift; + unsigned int reg_brightness; +}; + +static struct max77705_led *max77705_to_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct max77705_led, cdev); +} + +static int max77705_rgb_blink(struct led_classdev *cdev, + unsigned long *delay_on, + unsigned long *delay_off) +{ + struct max77705_led *led = max77705_to_led(cdev); + int value, on_value, off_value; + + on_value = (((*delay_on < 100) ? 0 : + (*delay_on < 500) ? *delay_on/100 - 1 : + (*delay_on < 3250) ? (*delay_on - 500) / 250 + 4 : 15) << 4); + off_value = ((*delay_off < 1) ? 0x00 : + (*delay_off < 500) ? 0x01 : + (*delay_off < 5000) ? *delay_off / 500 : + (*delay_off < 8000) ? (*delay_off - 5000) / 1000 + 10 : + (*delay_off < 12000) ? (*delay_off - 8000) / 2000 + 13 : 15); + value = on_value | off_value; + return regmap_write(led->regmap, MAX77705_RGBLED_REG_LEDBLNK, value); +} + +static int max77705_led_brightness_set(struct led_classdev *cdev, + enum led_brightness brightness) +{ + struct max77705_led *led = max77705_to_led(cdev); + int ret; + unsigned long blink_default = 0; + + if (brightness == LED_OFF) { + // Flash OFF + ret = regmap_update_bits(led->regmap, + MAX77705_RGBLED_REG_LEDEN, + MAX77705_LED_EN_MASK << led->en_shift, 0); + max77705_rgb_blink(cdev, &blink_default, &blink_default); + } else { + // Set current + ret = regmap_write(led->regmap, + led->reg_brightness, brightness); + if (ret < 0) + return ret; + + ret = regmap_update_bits(led->regmap, + MAX77705_RGBLED_REG_LEDEN, LED_ON << led->en_shift, + MAX77705_LED_EN_MASK << led->en_shift); + } + + return ret; +} + +static int max77705_led_probe(struct platform_device *pdev) +{ + struct fwnode_handle *child; + struct max77705_led *leds, *led; + struct device *dev; + struct regmap *map; + int rv, num_leds; + u32 reg; + + dev = &pdev->dev; + + leds = devm_kcalloc(dev, sizeof(*leds), + MAX77705_LED_NUM_LEDS, GFP_KERNEL); + if (!leds) + return -ENOMEM; + + map = dev_get_regmap(dev->parent, NULL); + if (!map) + return -ENODEV; + + num_leds = device_get_child_node_count(dev); + if (!num_leds || num_leds > MAX77705_LED_NUM_LEDS) + return -ENODEV; + + device_for_each_child_node(dev, child) { + struct led_init_data init_data = {}; + + rv = fwnode_property_read_u32(child, "reg", ®); + if (rv || reg >= MAX77705_LED_NUM_LEDS) { + rv = -EINVAL; + goto err_node_put; + } + + led = &leds[reg]; + led->regmap = map; + led->reg_brightness = MAX77705_RGBLED_REG_LED0BRT + reg; + led->en_shift = 2 * reg; + led->cdev.brightness_set_blocking = max77705_led_brightness_set; + led->cdev.blink_set = max77705_rgb_blink; + led->cdev.max_brightness = MAX77705_LED_MAX_BRIGHTNESS; + + init_data.fwnode = child; + init_data.devicename = "max77705"; + + rv = devm_led_classdev_register_ext(dev, &led->cdev, + &init_data); + if (rv) + goto err_node_put; + + rv = max77705_led_brightness_set(&led->cdev, LED_OFF); + if (rv) + goto err_node_put; + } + + return 0; +err_node_put: + fwnode_handle_put(child); + return rv; +} + +static const struct of_device_id max77705_led_of_match[] = { + { .compatible = "maxim,max77705-led" }, + { } +}; +MODULE_DEVICE_TABLE(of, max77705_led_of_match); + +static struct platform_driver max77705_led_driver = { + .driver = { + .name = "max77705-led", + .of_match_table = max77705_led_of_match, + }, + .probe = max77705_led_probe, +}; +module_platform_driver(max77705_led_driver); + +MODULE_DESCRIPTION("MAXIM 77705 LED driver"); +MODULE_AUTHOR("Bartosz Golaszewski "); +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_LICENSE("GPL"); From patchwork Fri Sep 13 15:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828676 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 8544B146599; Fri, 13 Sep 2024 15:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240133; cv=none; b=lMvcY8XUGbie9B+mW6xfJXapR175WQoD01mknwXCDKfbHtKClsgnuV78fSw8ykowTzhGsMtqgLYCNh7MnGyA/lxjKqxSx8mI8FH84h6C90vbjJmU76iXVrfD4dt2r+K/3JVk3/kKkuGF4Cn4Q6fWKtVvML/QrHQofpp9HQmvJ7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240133; c=relaxed/simple; bh=YbxXX5O1uF/FO7LjGr4qHVRuSX/d0hagRp09+kmoocw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PSb9KQgsyHF5NNAJZseHpJAheVeWY7ZeACR0WBmQPPdq8AWNDGM5VYd79y+mOf+oooAG86y+FyfjsWrhoOUr38bO5SnzQksUWup46jbxEXBue1NlkUV5JwX0c7j+vFB6hDSvS/aH+yDGUtewAIRkXx5iKz+ivHAHRSxUmjvAeuk= 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=nBicj8Sm; arc=none smtp.client-ip=209.85.208.51 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="nBicj8Sm" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c24ebaa427so5034937a12.1; Fri, 13 Sep 2024 08:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240129; x=1726844929; 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=aMyS4TGv+HH7D7PP1BOOaznRGSa+Pie/rUhrnOoO0p8=; b=nBicj8SmZL9svSZaXznsqpQqpXnv/3jnA9jajRQb+kz1+Ipj2Kla970JmZeHDaIQfT G2nsttmlhqpg54/kqSGGS6UJFc63ZRVRbpKKBqgTEfzSqHO+RM1ylpINRq4o5vofLgly W7+N1Z0AUpt5BwrumCU7tiEDAMr/V+tHWJLQ75MFLKjxSO+PQPC3HrXlfC73Z8mxQy0U DFToaLX9rOaF/j004AAjmeQfApqbLnQr6O+8spMRNr+FDqID6QHmrdASxxzbBoQlK7h/ uQzoSlqDUC9DmuAAdM0FJ9znGMIqxmqz2LxqfPxYUs3/j5SKSP24ixNS6k3OuUHF26C2 QzTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240129; x=1726844929; 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=aMyS4TGv+HH7D7PP1BOOaznRGSa+Pie/rUhrnOoO0p8=; b=PWYzsHwNDXvhi+GjKQ5xBxh1tXwMtmi/QKCyq5E/2llN+e/+9TPz280yUCwq+9+eqo /Qblf6y2vnrmWq+i/YvTpkVJPgv4PzgepSl9djkKKPbIjFdmPMg5IEW0zDPQol378m7X LihLZyj6RXAlgKAsxF/BYDJoyUST2Y0RT+sE8nUzlO55qBHSyenGQchMg0PDeC6znmpY yPeiEGxeVKKK2fTHqS1v/1jbx7xQ0tPFcuvmsOJH6GmjxT7KSHXEuLi/4+d4Lyc6IBlW Hj3MVRSwcmWp4T75uZa8czCjUzPcdogGe8l8UE7P9daVTTvH139Ot9/OZz8fsf5hQl4G Ylhw== X-Forwarded-Encrypted: i=1; AJvYcCUO0PweM0NLm43Ljz5nBqz2RkPmJupmdbrG+57hFL4R6v0JXnLbSLoCPEThgFYhMVD/rkVNI5cmaL64Cl8N@vger.kernel.org, AJvYcCUlhEXHTh4s4RKXpN7U5Gvkb2iBrqp2FvOUxFE68tKnSOzi9gXG74CIctJOJoK3TVO/urR42OF8Dv/LiNO2hA==@vger.kernel.org, AJvYcCV0VwikEusfU3GpJPCzazxdsfsD0t//mgb/cZ5p3pcErfFCSxXq0OIdf4EsbAbagsXPTtWwXaRXh9f/@vger.kernel.org, AJvYcCW7cs5+gc9g14cyk2XHAtXast/DIugkf5/WhDwcLgmzSPRbltFq4wLpaSqkMxTvjp110S3OTbPxNLr5@vger.kernel.org, AJvYcCWj3ho0rgZd+nplkhheV0963r9pQNF5CO65qVWYVUwZx+BWoCqvKvO0Lf/AbiQkjQZm9G6/WoaQuBC4q/c=@vger.kernel.org, AJvYcCXAeKztWgahep6b21E3YLdEsgKpIXSECJS/aQyBdnhe0O6s2k3lGXnxA5HgYHne/nbSGymZgnsojX1KuC/jBxsfQUU=@vger.kernel.org, AJvYcCXGCOxCHUlNtPYc2lEd2vKA7synBO5lO2wjS22wq23Fg/igMExzfRPayxoqbBinpghsH89WSYmsFlVqlQ==@vger.kernel.org, AJvYcCXz/dJ4GLe5t+ac42aIjh0cBMc1RPQHPCxgwWGHiFnScE9ASbiW6rWSggN7acUeIAk4067MZhtcDaXc@vger.kernel.org X-Gm-Message-State: AOJu0YyvQvecJ+OBTn1h/BEs+c6uAOe/Vj9uiIPKIqCHn+vy3KnCGjO8 /GmO4AKbv9qOA3TtmqXKSCYgLhbUfq+Fm0EFJ5wL5nB8vmqQmlNOMhEqcA== X-Google-Smtp-Source: AGHT+IHSrEZZjUESARYQ6fIarJ7TrElR8MiGf6iIEpLCfKv9PblhIITrPdP+yNEt2KLdvqVkd+x0iw== X-Received: by 2002:a05:6402:4144:b0:5c2:6f35:41af with SMTP id 4fb4d7f45d1cf-5c4018e5d05mr17182296a12.16.1726240129470; Fri, 13 Sep 2024 08:08:49 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:49 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:57 +0300 Subject: [PATCH v4 14/27] mfd: sec-core: add s2dos05 support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-14-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1802; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=YbxXX5O1uF/FO7LjGr4qHVRuSX/d0hagRp09+kmoocw=; b=F+1j39KA2eCELndZF8q3la6rvLp0yMuYrqvtxV93pOaw2HT1vWbRSfjl+rA9qYN4xKfR+oXs4 XFhJyAbMoYkDn8N8u94dQWU0o+kAVvUJZng5qVb6y3pq9e51TkboXTM 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 Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/sec-core.c | 11 +++++++++++ include/linux/mfd/samsung/core.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index a6b0d7300b2d..cdfe738e1d76 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -34,6 +34,10 @@ static const struct mfd_cell s5m8767_devs[] = { }, }; +static const struct mfd_cell s2dos05_devs[] = { + { .name = "s2dos05-regulator", }, +}; + static const struct mfd_cell s2mps11_devs[] = { { .name = "s2mps11-regulator", }, { .name = "s2mps14-rtc", }, @@ -83,6 +87,9 @@ static const struct of_device_id sec_dt_match[] = { { .compatible = "samsung,s5m8767-pmic", .data = (void *)S5M8767X, + }, { + .compatible = "samsung,s2dos05", + .data = (void *)S2DOS05, }, { .compatible = "samsung,s2mps11-pmic", .data = (void *)S2MPS11X, @@ -339,6 +346,10 @@ static int sec_pmic_probe(struct i2c_client *i2c) sec_devs = s5m8767_devs; num_sec_devs = ARRAY_SIZE(s5m8767_devs); break; + case S2DOS05: + sec_devs = s2dos05_devs; + num_sec_devs = ARRAY_SIZE(s2dos05_devs); + break; case S2MPA01: sec_devs = s2mpa01_devs; num_sec_devs = ARRAY_SIZE(s2mpa01_devs); diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index a212b9f72bc9..750274d41fc0 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h @@ -37,6 +37,7 @@ struct gpio_desc; enum sec_device_type { S5M8767X, + S2DOS05, S2MPA01, S2MPS11X, S2MPS13X, From patchwork Fri Sep 13 15:07:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828245 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 5DC391487C5; Fri, 13 Sep 2024 15:08:55 +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=1726240137; cv=none; b=dmu2h9SdbEIeiUMMmV1ADU54+DCetEZxCZqjAgGDho7v2+rgMIDbQIvh1f88cyPudfeaJ1D5VFoL8w0k2PWju4FksWu0kDgCAkHTvB8MjZ3L07WkeHmeunEZFWki52jNoQP9ILS5/Ygd0D06CUHGP6J+7AU1fzTvRuJ2abxW6uE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240137; c=relaxed/simple; bh=gf6ZfAOFwzhYiHvZhzXOirp3dlH6f9UkWyv1s06LoVQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hBf2foNe7G9F9d2JTrDmJdYF9w5OnRC5wp4ltNS9FgZin7u1HpI+xRTkzd+c8JatiAVqimub76Wwqw6ta7IDzY/JH2xlm//cEdc/lw6dAKq6zNgXXbZ71+tXg0iTs3VtTeOgGijIDNr9Gzn7E/GKntpIPyKaCx2r5BytkpOghqI= 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=c78HargU; 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="c78HargU" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5c412cab25cso1285060a12.2; Fri, 13 Sep 2024 08:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240133; x=1726844933; 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=WbbHD3pBQCrXX/cc6mXLHkXHRMGzQ7tUN2s603wyUA4=; b=c78HargUAOYQJ+uIZpSP+sX2xI1egivAJ0Owq7EXVHwtmYzQ2wn/Sk1vh1jxa3436/ 6m5KSv98HlPpM6diKKAv4/y6uE1zr4/1k8dPmVlAT5rDpncnYRsZoIFpNAddSfvvXct1 xIe7OVebb0VIbvOR9SlOOJXxBU+w6ovwoMugCT3mjVqLJCzjmY2YNEWTCbVtyV8v1Z+j BRUNzf3CLjrbDIiBN4rT9U8sygfKhoihMrISsGdqTNXYGoJP1n5ix63aoAoYpiHl/Lgg ZqB69bxqy/PLaZTEiOecs9m4+5neqHgOORoN1DJjHyI1CvMfbd2yIeDqNF9xGqoiD7QU 1k2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240133; x=1726844933; 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=WbbHD3pBQCrXX/cc6mXLHkXHRMGzQ7tUN2s603wyUA4=; b=xArN18wCp++r3zAvWMXSM6qAE46rUf8F1Y50hmh48ozwuD9c6dDpJTw7rFgJ5hG/Kv RsiuSnCsCv+YNBFipaaZtKJ7UEcPOG5zmFtqoMe8Hgme0EG4kfoZnbUjz8xITifnEx6z hpmnV+NVGqIXGH8Mv7H7+mEGu/zzU11EiPUoEv4z0aOIr+SQNIwTds2m4ej0ndYwplg5 5lkukLMjeEPZVX/TTG0PYis3YpZxS2uMuLxtKinEFy9h+SyDuNyygIOCaGv8iHO42Q/z rlgySx0ZxxKjY4BvzP2VB3o2+PI8XVA7GC7hg8vLYQ0LZcM+7XLdvCw0Rnsq7ukpxbvE 2REg== X-Forwarded-Encrypted: i=1; AJvYcCV+bkM7jA55413dBXkvVjqMDnzzEtlqaorC8U8keqotj3Vf9Ao/pilORkNWMfn10Qiz6IJLUz6+VQB1@vger.kernel.org, AJvYcCVZkfnGBN9iDqTsu8EF31Q3hWpTEMShKipMRLO9foXwRJUY/c2gEVMoPu2OZhbP/KcHRslZLwDsUJQGSto7BQ==@vger.kernel.org, AJvYcCVfCGoTYxV6dN8xFI0IOIs9XR1uxFwkVgN+2gqve7wxOLyUAWaTuqNeIFAaL/knWvIyhp29CqrMwJT9VA==@vger.kernel.org, AJvYcCVixN99ShJgJPNjHIpz0MEoER20t07L4uyEb4aFtEKcpceORsfoWeHEO3do20BSKwBMle3pil5n6Qbs@vger.kernel.org, AJvYcCWEi7kex6asg5xcqA+vtrvaIbr2MO0V9YuyqasZFI0or+pw6d9Upc/iJ4VQiT4Jz1+UQhbuljRTYAO97LY=@vger.kernel.org, AJvYcCWm9/Vej+MJvRnAyOSyI9kBFYtC1toJMiRcVC1zgoRk4N3/ZrG/y/kndmqZLMwYezSI0yqC6NAYqk/qwfHr@vger.kernel.org, AJvYcCXGQdKvG3UkTynthyVjFWo3xQJcqBG1otdLZN8NLGJXiqvG99qWGNmdj6kaNdzEHRx/wlQC2UQebcopX5YkoQvcNfM=@vger.kernel.org, AJvYcCXI6y0iwM7IkcyzGke49XzphIF0aPPQxa4vI7h5E7t5YXy5fw93AAbjsX6Dcb7RU1cgT1gEqiDUkfOe@vger.kernel.org X-Gm-Message-State: AOJu0YzRDX3GbNSCHoYR973yIlFh1QZStxcnk+Xurzae0Tcv67gn8FJm DmoVDllzFNluRl+feMTxe1u6Qb7XNF6wBKWjQCsSwm0rPgUl5m7maDKfqQ== X-Google-Smtp-Source: AGHT+IFrmIcqq1MIf8LJhgEBVPH8le+KZ8m6oAVmRkOcVVRBGVEXkH8BWNxmWG6j86+uLzYaXOGxyA== X-Received: by 2002:a05:6402:d08:b0:5c3:cb1d:8176 with SMTP id 4fb4d7f45d1cf-5c41e2ad471mr2096600a12.30.1726240132760; Fri, 13 Sep 2024 08:08:52 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:51 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:58 +0300 Subject: [PATCH v4 15/27] regulator: add s2dos05 regulator support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-15-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=10690; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=gf6ZfAOFwzhYiHvZhzXOirp3dlH6f9UkWyv1s06LoVQ=; b=WhfjlLx+ght7ekqiofm8OEYevYj8ZRvBqndBLYsoIsW26vQk2a0wLl3m5Qq5t3Mjk/v+L8HeS P19gyMylJekBZPxK2iHiVdZuVGtIM/JJY6lnKdZSCeV8v88PgSTpNFm X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= S2dos05 has 1 buck and 4 LDO regulators, used for powering panel/touchscreen. Signed-off-by: Dzmitry Sankouski --- Changes in v4: - remove excessive linux/module.h import - use generic regulator helpers - use of_match - use devm_* for mem allocations - use // style comment - drop all junk Samsung code - adjust to depend on sec-core --- MAINTAINERS | 1 + drivers/regulator/Kconfig | 8 ++ drivers/regulator/Makefile | 1 + drivers/regulator/s2dos05-regulator.c | 176 ++++++++++++++++++++++++++++++++++ include/linux/regulator/s2dos05.h | 73 ++++++++++++++ 5 files changed, 259 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 444cc855a01e..25dcce07180a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20476,6 +20476,7 @@ 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/sec*.c +F: drivers/regulator/s2dos*.c F: drivers/regulator/s2m*.c F: drivers/regulator/s5m*.c F: drivers/rtc/rtc-s5m.c diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 4b411a09c1a6..63085d73cf74 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -1322,6 +1322,14 @@ config REGULATOR_RTQ2208 and two ldos. It features wide output voltage range from 0.4V to 2.05V and the capability to configure the corresponding power stages. +config REGULATOR_S2DOS05 + tristate "SLSI S2DOS05 regulator" + depends on MFD_SEC_CORE || COMPILE_TEST + help + This driver provides support for the voltage regulators of the S2DOS05. + The S2DOS05 is a companion power management IC for the smart phones. + The S2DOS05 has 4 LDOs and 1 BUCK outputs. + config REGULATOR_S2MPA01 tristate "Samsung S2MPA01 voltage regulator" depends on MFD_SEC_CORE || COMPILE_TEST diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index a61fa42b13c4..d26e0db7c825 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -154,6 +154,7 @@ obj-$(CONFIG_REGULATOR_RTMV20) += rtmv20-regulator.o obj-$(CONFIG_REGULATOR_RTQ2134) += rtq2134-regulator.o obj-$(CONFIG_REGULATOR_RTQ6752) += rtq6752-regulator.o obj-$(CONFIG_REGULATOR_RTQ2208) += rtq2208-regulator.o +obj-$(CONFIG_REGULATOR_S2DOS05) += s2dos05-regulator.o obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o diff --git a/drivers/regulator/s2dos05-regulator.c b/drivers/regulator/s2dos05-regulator.c new file mode 100644 index 000000000000..1325c8311b08 --- /dev/null +++ b/drivers/regulator/s2dos05-regulator.c @@ -0,0 +1,176 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// s2dos05.c - Regulator driver for the Samsung s2dos05 +// +// Copyright (C) 2024 Dzmitry Sankouski + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct s2dos05_data { + struct regmap *regmap; + struct device *dev; +}; + +static const struct regulator_ops s2dos05_ops = { + .list_voltage = regulator_list_voltage_linear, + .map_voltage = regulator_map_voltage_linear, + .is_enabled = regulator_is_enabled_regmap, + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, + .set_voltage_time_sel = regulator_set_voltage_time_sel, + .set_active_discharge = regulator_set_active_discharge_regmap, +}; + +#define _BUCK(macro) S2DOS05_BUCK##macro +#define _buck_ops(num) s2dos05_ops##num + +#define _LDO(macro) S2DOS05_LDO##macro +#define _REG(ctrl) S2DOS05_REG##ctrl +#define _ldo_ops(num) s2dos05_ops##num +#define _MASK(macro) S2DOS05_ENABLE_MASK##macro +#define _TIME(macro) S2DOS05_ENABLE_TIME##macro + +#define BUCK_DESC(_name, _id, _ops, m, s, v, e, em, t, a) { \ + .name = _name, \ + .id = _id, \ + .ops = _ops, \ + .of_match = of_match_ptr(_name), \ + .regulators_node = of_match_ptr("regulators"), \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .min_uV = m, \ + .uV_step = s, \ + .n_voltages = S2DOS05_BUCK_N_VOLTAGES, \ + .vsel_reg = v, \ + .vsel_mask = S2DOS05_BUCK_VSEL_MASK, \ + .enable_reg = e, \ + .enable_mask = em, \ + .enable_time = t, \ + .active_discharge_off = 0, \ + .active_discharge_on = S2DOS05_BUCK_FD_MASK, \ + .active_discharge_reg = a, \ + .active_discharge_mask = S2DOS05_BUCK_FD_MASK \ +} + +#define LDO_DESC(_name, _id, _ops, m, s, v, e, em, t, a) { \ + .name = _name, \ + .id = _id, \ + .ops = _ops, \ + .of_match = of_match_ptr(_name), \ + .regulators_node = of_match_ptr("regulators"), \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .min_uV = m, \ + .uV_step = s, \ + .n_voltages = S2DOS05_LDO_N_VOLTAGES, \ + .vsel_reg = v, \ + .vsel_mask = S2DOS05_LDO_VSEL_MASK, \ + .enable_reg = e, \ + .enable_mask = em, \ + .enable_time = t, \ + .active_discharge_off = 0, \ + .active_discharge_on = S2DOS05_LDO_FD_MASK, \ + .active_discharge_reg = a, \ + .active_discharge_mask = S2DOS05_LDO_FD_MASK \ +} + +static struct regulator_desc regulators[S2DOS05_REGULATOR_MAX] = { + // name, id, ops, min_uv, uV_step, vsel_reg, enable_reg + LDO_DESC("ldo1", _LDO(1), &_ldo_ops(), _LDO(_MIN1), + _LDO(_STEP1), _REG(_LDO1_CFG), + _REG(_EN), _MASK(_L1), _TIME(_LDO), _REG(_LDO1_CFG)), + LDO_DESC("ldo2", _LDO(2), &_ldo_ops(), _LDO(_MIN1), + _LDO(_STEP1), _REG(_LDO2_CFG), + _REG(_EN), _MASK(_L2), _TIME(_LDO), _REG(_LDO2_CFG)), + LDO_DESC("ldo3", _LDO(3), &_ldo_ops(), _LDO(_MIN2), + _LDO(_STEP1), _REG(_LDO3_CFG), + _REG(_EN), _MASK(_L3), _TIME(_LDO), _REG(_LDO3_CFG)), + LDO_DESC("ldo4", _LDO(4), &_ldo_ops(), _LDO(_MIN2), + _LDO(_STEP1), _REG(_LDO4_CFG), + _REG(_EN), _MASK(_L4), _TIME(_LDO), _REG(_LDO4_CFG)), + BUCK_DESC("buck1", _BUCK(1), &_buck_ops(), _BUCK(_MIN1), + _BUCK(_STEP1), _REG(_BUCK_VOUT), + _REG(_EN), _MASK(_B1), _TIME(_BUCK), _REG(_BUCK_CFG)), +}; + +static int s2dos05_pmic_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); + struct of_regulator_match *rdata = NULL; + struct s2dos05_data *s2dos05; + struct regulator_config config = { }; + unsigned int rdev_num = ARRAY_SIZE(regulators); + int i, ret; + + s2dos05 = devm_kzalloc(dev, sizeof(struct s2dos05_data), + GFP_KERNEL); + if (!s2dos05) + return -ENOMEM; + + platform_set_drvdata(pdev, s2dos05); + + rdata = devm_kcalloc(dev, rdev_num, sizeof(*rdata), GFP_KERNEL); + if (!rdata) + return -ENOMEM; + + for (i = 0; i < rdev_num; i++) + rdata[i].name = regulators[i].name; + + s2dos05->regmap = iodev->regmap_pmic; + s2dos05->dev = dev; + if (!dev->of_node) + dev->of_node = dev->parent->of_node; + + for (i = 0; i < rdev_num; i++) { + struct regulator_dev *regulator; + + config.init_data = rdata[i].init_data; + config.of_node = rdata[i].of_node; + config.dev = dev; + config.driver_data = s2dos05; + regulator = devm_regulator_register(&pdev->dev, + ®ulators[i], &config); + if (IS_ERR(regulator)) { + ret = PTR_ERR(regulator); + dev_err(&pdev->dev, "regulator init failed for %d\n", + i); + } + } + + return ret; +} + +static const struct platform_device_id s2dos05_pmic_id[] = { + { "s2dos05-regulator" }, + { }, +}; +MODULE_DEVICE_TABLE(platform, s2dos05_pmic_id); + +static struct platform_driver s2dos05_platform_driver = { + .driver = { + .name = "s2dos05", + }, + .probe = s2dos05_pmic_probe, + .id_table = s2dos05_pmic_id, +}; +module_platform_driver(s2dos05_platform_driver); + +MODULE_AUTHOR("Dzmitry Sankouski "); +MODULE_DESCRIPTION("SAMSUNG s2dos05 Regulator Driver"); +MODULE_LICENSE("GPL"); diff --git a/include/linux/regulator/s2dos05.h b/include/linux/regulator/s2dos05.h new file mode 100644 index 000000000000..2e89fcbce769 --- /dev/null +++ b/include/linux/regulator/s2dos05.h @@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +// s2dos05.h +// +// Copyright (c) 2016 Samsung Electronics Co., Ltd +// http://www.samsung.com +// Copyright (C) 2024 Dzmitry Sankouski + +#ifndef __LINUX_S2DOS05_H +#define __LINUX_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 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_LDO_N_VOLTAGES (S2DOS05_LDO_VSEL_MASK + 1) +#define S2DOS05_BUCK_N_VOLTAGES (S2DOS05_BUCK_VSEL_MASK + 1) + +#define S2DOS05_REGULATOR_MAX (S2DOS05_REG_MAX) + +#endif // __LINUX_S2DOS05_H From patchwork Fri Sep 13 15:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828675 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 4C25814AD19; Fri, 13 Sep 2024 15:08:58 +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=1726240140; cv=none; b=EK0Jru3vu/6oe7z3mWgWxRt94VERLT4tXijtxyUgj5Enz4HmQQbxhaGpU/h0gSCgQvaT2YuBZV/mb2EAMCl85MTku/qrELCrFeuRG4Rf0UqaLS9GtRB1TWpiyqS2onS+2qYgB5hA4Sc5ZbU/PinQNsQCMI7ftz/1Us3P1zt2m9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240140; c=relaxed/simple; bh=TWhbLRHfFDz9yA9edxLZxAOMPF84aLyauDMExbKBA/I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dvEnScjPRju4jbfimP3Ifl7+KWG2rzNCXMptYYROAx2FKfpPSRAPjQGWHTEgBUEavAnqhqo9UpQ/IAZ93R72aSNGoTM3cu18oUG0Hykbz5VXvvOkGJ1d7nQiAq7rdO0UEcm9riLjva2ZJpRMINYP3kNR7HUt1uCBoBGB8J7p7cg= 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=VwKb5S0s; 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="VwKb5S0s" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c260b19f71so2564021a12.1; Fri, 13 Sep 2024 08:08:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240136; x=1726844936; 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=xTfratRyuq67AZV4B16yqUQQ15TZWLuOZUKKSVeMFLU=; b=VwKb5S0sg8EPgw2IdY3AbDiNsIs1G7JRhM+jic0c7aMiTNDk426V16NQxsOnOALbb9 P7vQXIgT8z0URbHxppx4OEKgD23872xncgQKsqj1DLekQJ2WdqB4zTlywxfU6qsAx8DP 3qNG6LlzDTJL9HY5//Muhre3aWm9h5YIW43r/JsODQ8nBL6CX1eMrPtiG/XeEHnmFeLG x/Yj6ZclrChct1a4teW2lNAhxXHJ7OHrBt+aHlGWA/feOuHYwfyDF99Yqqmgp846Y63y WQnL/lJWKuPuvjdxcVZTkkP2LO4VYwDpnmpY+H7NwNc9793dKCoLjTZFmN1nO2LZfLzF PGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240136; x=1726844936; 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=xTfratRyuq67AZV4B16yqUQQ15TZWLuOZUKKSVeMFLU=; b=mKu9+FQvCGAF06ZUS+/VtdGG7Ujjk/i35BN7Id7vnO9/LCB7l6osPaUsnCEEFwJK2l aDjA++tP0zvtEAhOIX5CCvIIlfUL6Ye4dC1upD8Xq2RqH6YbgLBWo9oXBkFSIztQ/zJ2 YnDl8N75WVdAE46YZZ5fq5lfsN/6uEFhP0cIj93IX++6hijGtrevETh8blaQJkBtjXq+ oVVR9I/X6dbdc8ILQfgWhehRW9W4NSF9U0CHqDnVGK6ltLEqXig6ZocjKeodsPRqRUJF wxI7dh3WOy2l4AYagF+yCdmhvpZDYzzs9v/m2LirjFvkEjAawKtZMp4Wfmyjyy3eWmkR FV2w== X-Forwarded-Encrypted: i=1; AJvYcCUNNtkyybN/K7yvJa6MNt24ldpdZhnbk+Ds/QNdmsELQa54zQY43JZQYVsK9p5DjnTYJbAs3Q4niWOY@vger.kernel.org, AJvYcCUpjOhNvBnzrlH4LRRU9n3n6zOXg6E/9RfhAaQeBw0KogpL64sPi0tF+/WiN5cDyEWUl4QenSGsPKmH@vger.kernel.org, AJvYcCUs57XXzB0+8bGOIHS8tHn1GfhEGy66XqHufRtI0iJ1P1CifP2BakY85q1zSNkhvKDOhaRNDBECRTAU0sMEcHr+nno=@vger.kernel.org, AJvYcCVIwzsiiOW8VXN4ZjRJzCMmy6Ha4I7JkRPVM2WOPGdrh8twZ3T+JZHGpYtbrP9hO8iUF+hYfzepRedYVdA=@vger.kernel.org, AJvYcCVQ5AQnqCv142+SKO3TR9ByFDUVeVzL10Pjbkgq/S1ZuOUnIBzLlNAmXK89Wmp3KZUVL8G8BHIj3CiAqA==@vger.kernel.org, AJvYcCVRlYnBB0dfo/WnPIJwulREYGydQtW+9B6nYZN2hAH8svfzIjgoTRvJUFG6pf54RC6Yj/AFlkX6dJbbtco7zQ==@vger.kernel.org, AJvYcCVmjGVFSzSfFbtiEy8KHmTo4OJRgP6LkwSmkFZmsR6tNt975ol+BVBkinkp0h+DSN6bjvtjAirdaai9@vger.kernel.org, AJvYcCXrHEaeCg6P9+rWcTlQniraVcPULyd9opNTAPKC1uQJ0JM5qdLX/VBotdRcBNoQsG1J5nDhsJ+mSNn/j+Ce@vger.kernel.org X-Gm-Message-State: AOJu0Ywc6Pjm57QZRD94ZTjp6J9bCYx3wo4f/TXxI2hdDi0I27waCJgR xROidBQ4Cp5R4ItMFmL4OsA6strLyRJMHV8z7Z16Uqiac3TCfbbZTRY6wg== X-Google-Smtp-Source: AGHT+IGnH2Qg/ZVH+t5yBK8/6cZxMgcc2yO30j7Z0MVpdCvW68EAVdYqOzZsoNLDjONJTNNxLjdrhA== X-Received: by 2002:a05:6402:2750:b0:5c2:60ac:fdd8 with SMTP id 4fb4d7f45d1cf-5c413e12321mr4607671a12.13.1726240136234; Fri, 13 Sep 2024 08:08:56 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:54 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:07:59 +0300 Subject: [PATCH v4 16/27] arm64: dts: qcom: sdm845: enable gmu Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-16-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=4473; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=TWhbLRHfFDz9yA9edxLZxAOMPF84aLyauDMExbKBA/I=; b=C8aX8Dj2cCP4OKpYbwpqDfK4kLs39w/QmL2hpGyOr0fraXfQ9aXJ94InXPuEDu9NQVEQ39bkD CPgTNAmlnHfDz8Bvo5lvW1khQtDQLpt6K0HMdk/rsv/kbU+YSvoYKZJ X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Leave gmu enabled, because it's only probed when GPU is. Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 4 ---- arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 4 ---- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 4 ---- arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 4 ---- arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts | 4 ---- arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi | 4 ---- arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi | 4 ---- arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts | 4 ---- arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 -- 9 files changed, 34 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi index e8276db9eabb..a5149a384167 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi @@ -741,10 +741,6 @@ touchscreen@10 { }; }; -&gmu { - status = "okay"; -}; - &gpu { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts index 9a6d3d0c0ee4..59cb6e6e434c 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts @@ -444,10 +444,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpi_dma0 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts index 2391f842c903..d31efad8a321 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -414,10 +414,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpu { status = "okay"; diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi index 46e25c53829a..8a0f154bffc3 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi @@ -345,10 +345,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpu { status = "okay"; diff --git a/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts b/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts index 486ce175e6bc..87fc4021e024 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts @@ -419,10 +419,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpu { status = "okay"; diff --git a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi index b02a1dc5fecd..a3a304e1ac87 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi @@ -415,10 +415,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpi_dma0 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi index 617b17b2d7d9..f790eb73abdd 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi @@ -239,10 +239,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpu { status = "okay"; diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts index e386b504e978..501575c9beda 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-polaris.dts @@ -381,10 +381,6 @@ &gcc { ; }; -&gmu { - status = "okay"; -}; - &gpi_dma0 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index 54077549b9da..fe154216f138 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -4948,8 +4948,6 @@ gmu: gmu@506a000 { operating-points-v2 = <&gmu_opp_table>; - status = "disabled"; - gmu_opp_table: opp-table { compatible = "operating-points-v2"; From patchwork Fri Sep 13 15:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828244 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 9E19F154458; Fri, 13 Sep 2024 15:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240143; cv=none; b=F2F4Y0IKYTrZMtkN5LfleYJBaHOwTfv9DmiPYxkWWn9SUWDUzgnmMaiJKHYGbQuRfOshdMkjczVxqhsgfaFwz/6j5ebH0zvxVcn5b3GtBFydM/7dxGh6OImm7q4RtCYqTZMpjt6VkdYYl0JFA8ulwF+gBnGJvE4h2U415lnVLr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240143; c=relaxed/simple; bh=Eph7e0S45r0MTRyCXF3ejlfGwAhuMntaPM1lDGhJahM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WJCnuwF3k1MBzz7TRjuf3+YVKofkvVQv3W8BHU/+IGowbBh6GtNDuAKRG0+5fyY7E4jBdjyFk8I6Z5N61TlvuwCWSO8NwOhSvqwYI1iGOr8ezCBI9ejLR6x3JxFtv82GmzrHaq02cfQkkpY6op6YLmM2cPeTnw7SartATckV12E= 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=AenlUwaq; arc=none smtp.client-ip=209.85.208.176 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="AenlUwaq" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2f7657f9f62so26899521fa.3; Fri, 13 Sep 2024 08:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240139; x=1726844939; 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=+MogS/GsWGussElbxSTITWgB14U3ovrKNCk5uQtTkgQ=; b=AenlUwaq1f0j0Nngv0vOB5WjJWao62jq7LvohYJFPgpTPR4HsLSjQS2zPYlXTdbGQ9 aNwDH70Medh45iiMNeUawDOVmaZHnFGMoP9NYk+/uRc/IRZoO3WTf2eEk64zomW5VSsH uGx1gISiFIRTiD+noGsu6UXE2q/PA1sFD40BjP/2b253MvViWyInop2MJNmKTccwjdEv d0Z7UD+RmaJrqjcRPRo8O7HBzT0sq1qXd+ynfytiHltoUT9dypTTv53D0xrkYMBLkWYh 6wzrkDdg95hmbFZ04mIWYslzd7+Tge9odzkDSiVsRBwq19cXWsf7QneCRQWUG32tpDt1 nvEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240139; x=1726844939; 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=+MogS/GsWGussElbxSTITWgB14U3ovrKNCk5uQtTkgQ=; b=SBHI2NSOtLgIsuzM9voYtonDR+IQkDw3pv7lomAf+XCbVXdm+P42KZ4iIWOEDXZ33b vt6Rmic9iIPbJceqv5k8qd+PEP1P3xNBVVoAK5z+XzS/r09ZAfeU4rzFIJ304MkGjYk5 chHF7xP+vTyYRZlY9BbL28OKucLFJLy9hCexRtIMDw3c/NbbbKmGHkQ8ix+5phgq1xDN 9VS8/RRtjL70K7QmfuIfVPAQbvMDeh2hDVodKRNqEKga82NKo/LeXlBXD6qxijTYJhbS dmpzR1DKB84gOsgIn3QdOWy+ErAvX/+a6iMSLGQEbr2Ld94NfCsb9/+4C6C3QdsX4lX+ EZWA== X-Forwarded-Encrypted: i=1; AJvYcCV55UKG3vTamoAICC2NPyvMTDj3aNhAV6Wtb6H6s1ZwHUFazCZ/rJ/7up77PgxFrYIjwDv5acMi2SDa@vger.kernel.org, AJvYcCV7I+NgaquxDyRvpkrTIthf+miMjRCtk+N1EM16kAQSm1m16261dMbS7AZVzj96uwdSlnSv2AITeUxcWFWs@vger.kernel.org, AJvYcCVjhWRq1gIWVdOIxcyhkcl8JyL7fmOtZmY9j1Z1LoV1F25b95LGBOn2F+mpvYYDW1c0LYXQSIle6TOw@vger.kernel.org, AJvYcCW7YgRJVXwt0sBSHjK9vugn1051pHAeWDQnhufDMEzQPYW0rzPOCWKHKYVAZ2xJd2LMFlHnlD2u9ZSPsgYEPkla9Wk=@vger.kernel.org, AJvYcCWb74j9KHSFuFlaLnwcy0oGGNg2EDVPr+zal1qjrq6WiGr6StZwxmLlR0pXq1WAeDyEmFrtLF0aEvQepN8ldA==@vger.kernel.org, AJvYcCWrgxHiKaJJFL2BmljmuU9cayXiMQCwT5q7IdaLL8Yknjqg5CELZDLFgL1jA9n2FG+dfzx0c49iNqnZlQ==@vger.kernel.org, AJvYcCWxBDIGwNE4IQcdBIbJrjPOObr1DIISIfWt0aoLPSXJHpM+6a1Jg4pCNtlB9SjF4HkxO/OyMCjA8kDNx7Q=@vger.kernel.org, AJvYcCXK+5H61o01tFuXd081zBjuODOnKJQXrg5ukMkVvRjIX55Z1TvD9Ij0zvIhjyjodrEVcHPnakKuqjhr@vger.kernel.org X-Gm-Message-State: AOJu0YwLJtJqZdUTB0NvMs0qij0OD4/O/7sZeC30T3tBaQuOgHe2oBFB aIbKjjjaKDtkIUaJ1NR9hHl6NC+YfhjvMPTOhTgz6G742ezt4rm23LhZXw== X-Google-Smtp-Source: AGHT+IG15UZQPWFKTrEWMJoYpOjTZRs1/pybTllYbPk3ZUCPtTA6NrMHeSupfUSZWg7LhFQUdQrI6A== X-Received: by 2002:a2e:a9a6:0:b0:2f7:7f76:992b with SMTP id 38308e7fff4ca-2f787f4484dmr38107941fa.37.1726240139396; Fri, 13 Sep 2024 08:08:59 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:08:58 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:00 +0300 Subject: [PATCH v4 17/27] arm64: dts: qcom: starqltechn: remove wifi Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-17-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1053; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=Eph7e0S45r0MTRyCXF3ejlfGwAhuMntaPM1lDGhJahM=; b=vALQnYl3+w5MCg7sDPNqQFdT/NtoYAqeD+ucytbEKKHkbRr5ArqYw4dNgJg++Oy86E0lACe3V f9aB8bebsZhDs8mQDd098TOeyreaGhbxS6kdp6OHR7eJJBg8bLkG6CV X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Starqltechn has broadcom chip for wifi, so sdm845 wifi part can be disabled. Fixes: d711b22eee55 ("arm64: dts: qcom: starqltechn: add initial device tree for starqltechn") Reviewed-by: Konrad Dybcio Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index d37a433130b9..6fc30fd1262b 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -418,14 +418,6 @@ &usb_1_qmpphy { status = "okay"; }; -&wifi { - vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>; - vdd-1.8-xo-supply = <&vreg_l7a_1p8>; - vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; - vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; - status = "okay"; -}; - &tlmm { gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>; From patchwork Fri Sep 13 15:08:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828674 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 1C5F9156871; Fri, 13 Sep 2024 15:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240145; cv=none; b=pn8bx8QhZWz8lM3pyDa1HlJHLBO/Oxce5lHOdaqNgO5WeZjnV0xI9PR0UPMKTMCFGVqi3qQnfockByfCwf4j9M2cDRy87w+czaL2psKLRNChPTkrMUTqLfSMilcU7i0GukAx92jVrY+Iq/k/uOZuZwD5U7gMDrDa2QmYQzOY6bU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240145; c=relaxed/simple; bh=HSWoKU+U+LciT4YeTMc8x2BUj723ugWiGdsGsQ5TSgI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C3RqhTmJAfa6gpAXY0OeeuOp0OrkN4lbNEZMDPhpqXoHrJ8vaTDwHamMFRyXwibwqaUDTemoExyJYQWkcBYR5v9Pmn5WmVsMCf/q/BU6gaS9jUyx6m+1iMX98F/YK/15exc4whkofUP65UZbppwItST2OSMU5ToRKsge1gPQUms= 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=C+Pk/Wzt; arc=none smtp.client-ip=209.85.208.50 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="C+Pk/Wzt" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5c40aea5c40so3784986a12.0; Fri, 13 Sep 2024 08:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240142; x=1726844942; 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=BXU7Bk7WbuxNrJusNNOpHMNB9jnyfgFFtQVMoYQpR+c=; b=C+Pk/Wztsj1YTOaALYUmaADnjo6ukJirZNbnpDH75cvetONlIMLl3CJdYBDYnTp+hl qUKhgAC63UZY5XJyZhz2B3f3wssTLuNk277w5L1WC5ZqYdQZkcfG0v5CwmakrQAj1Hxz v7gVeovWkDGoBNRBZcRgfYSCKx2K/DR9MyL2BnCr4FTpDGjSEoV6OC8PXpIpKTnjwXyJ hE76skqlWZLQ/mIXbfcBz1aSIEZF5tx0CcGyIKCaQzoz/kCVtW7SvwavL9g4STgWiKli +3rPHS5WGLLLMpGUHmtYYfwKW0EXPRRFLsGyORJ+Q4dtQ47/5xr6jNg3yk33Qqte0jrd vzbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240142; x=1726844942; 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=BXU7Bk7WbuxNrJusNNOpHMNB9jnyfgFFtQVMoYQpR+c=; b=MQYVz/yb8X1L/3juheg7W64lLSymsItpHQQAChGFmSnhjcbBU5r57Zpai5LrnWrfU+ Se3Vs4y8rEL+VcA9M4JXPbQQQYOLPSrPSaQkIdwja45wWeA5eAnvBVU5GJM2Z5Y8jvt+ mqOmPB6U3z0AkcAxoLpbQqvv8yzQ5ryc7LFNooSov36b7IPIknliZiaBYiP4QircjTPc I++ILfyUEDSGUSetq+oVt7/aN5WoaUQgmgN69FySN/1ZJ7A/gMkzM1DRcunUj8L9SkqZ CZPXiomxE+m1IjRv6lU8gzqRjtwiMExin1pbNg1ZiZZTVAV2OWLufaUEGJ2myZDV1AU4 fO5A== X-Forwarded-Encrypted: i=1; AJvYcCU1y90E/AlNx81AOxb6lGOjVi+gacXkY2xqYGqUqdQuPvUOrj4m0D0nVvwPoTxVFVVeObmQWZ5eUb32@vger.kernel.org, AJvYcCUBW9BSvWEd3mQRfc6r/GxVF+ZL6FGtuF1HPHuNBunOb+75eHgoOu+oGCKo86Eb5OnsMa43uzUwWxzcWk8=@vger.kernel.org, AJvYcCUa/XUWzgkAiRoiCCVJbcW+V+xyY432Aum3YXzSNyR4hDPcQBh0KFLSEm1Bo8DVYvUBKJQiDnBpRr/TLnyX@vger.kernel.org, AJvYcCV5OMJtLU7xIc8J32sTf8Ckhn6tssMg74G7eRCHPTvMLW9QggjWi64+OYhZQkJqHbqy2td9Rdr7eXZM@vger.kernel.org, AJvYcCVTdMJuIN+RsJepQN9ehMQZNFXlydwr/LiikgdVlFQBltassvwS1oE1rM9oFg7AKV0YbaUnpuARVPi+YQ==@vger.kernel.org, AJvYcCWSQo/kLRWShXNNGoWQ/HhzBNdf7GIsHZ7zuD9QMmk4HlMxryi0ckIF9Y8SnuFe4QQHsRBBnqhqsfEoDI8x5k5lW84=@vger.kernel.org, AJvYcCXLXvUY6b7TahGEtnES2LrgL7cLCSnszWHmfv+FXnMFlz6LweX0evmnL/+uabf5SlOVdQ383Pi7FbVyBeACsQ==@vger.kernel.org, AJvYcCXPdR6B4HBntPxVNTOXjG7AcDObQBBdpAT/+WJdnlD33IDLt5DTmefqM8qu2MgGMIykM1VipI8Ay+Hr@vger.kernel.org X-Gm-Message-State: AOJu0YxD0xrRRlQsj0PPjfRPFfIQrBBpV9qoioDIzAWrWMuDEMH91X3e l/P6zU8en89vfLxcYAI3yIrkzo97+QzpZ+TzvRPvTQzoZ2z1jlkWsbIK0g== X-Google-Smtp-Source: AGHT+IFPFN2hgO9Tc/ykeRzTBK0HjTBEB69PqXe0jnVSoprAC4LV1n+xcHFAg/BqAAvInrtE8uuQOA== X-Received: by 2002:a05:6402:4144:b0:5c2:6f35:41af with SMTP id 4fb4d7f45d1cf-5c4018e5d05mr17183384a12.16.1726240141881; Fri, 13 Sep 2024 08:09:01 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:01 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:01 +0300 Subject: [PATCH v4 18/27] arm64: dts: qcom: starqltechn: fix usb regulator mistake Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-18-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1140; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=HSWoKU+U+LciT4YeTMc8x2BUj723ugWiGdsGsQ5TSgI=; b=D+7T9Oxef0XYg20n1/Xa29buVBAn6lwn1W7nUsmHfsGRH87CSRz/m/NLhRujUszUERs1tecW+ t3C465cB/vWDAK9O9guDMz1HyewrsAqz5qVyv4APhCKKFgtGJkHCywI X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Usb regulator was wrongly pointed to vreg_l1a_0p875. However, on starqltechn it's powered from vreg_l5a_0p8. Fixes: d711b22eee55 ("arm64: dts: qcom: starqltechn: add initial device tree for starqltechn") Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 3 +-- 1 file changed, 1 insertion(+), 2 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..f3f2b25883d8 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -135,8 +135,6 @@ vdda_pll_cc_ebi23: vdda_sp_sensor: vdda_ufs1_core: vdda_ufs2_core: - vdda_usb1_ss_core: - vdda_usb2_ss_core: vreg_l1a_0p875: ldo1 { regulator-min-microvolt = <880000>; regulator-max-microvolt = <880000>; @@ -157,6 +155,7 @@ vreg_l3a_1p0: ldo3 { regulator-initial-mode = ; }; + vdda_usb1_ss_core: vdd_wcss_cx: vdd_wcss_mx: vdda_wcss_pll: From patchwork Fri Sep 13 15:08:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828243 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 0387E1741D2; Fri, 13 Sep 2024 15:09:06 +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=1726240148; cv=none; b=j/9SUxL09fIJA83plvRWAzURCy0UgDqNJR6McYaTx2SxcDuPLWCJS/i+HHfz1Dn8p33QfmobiEWW4bpnlB6ce2Za2Yff7mXjSFNVsYO2teKcAZ+tkb7XFdLBAa1yFeFNarlC+pyTcJG38Hz6t4sRyQZQw+yTwOQmlW4gIi69HLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240148; c=relaxed/simple; bh=LXgqSMJKPpptWHRjG5sGV+9Z8Lxj5jA8H20WF+m2cbs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uzjXhOcic5K1jPcFg8yBfqzk/7qhp3s4exbf1OuGzx2ORZYbVyC2FckdALwUMVvm1b77JPBkEEnJ7iapQW0q2GPzKgPkRLEmdwjSbnWRX64yJwz1HYiHC2PYI82oCgA4WftWlg4HgbOJdK8oaLtra5KCT3suwZrSVb7cy80M7uU= 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=EQQS/Xxe; 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="EQQS/Xxe" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5c24ebaa427so5035339a12.1; Fri, 13 Sep 2024 08:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240145; x=1726844945; 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=hxV+xEnMJ80gLhFAUliu5RFc0rPgxSLDZdSiAt5SbDY=; b=EQQS/Xxelu+FR7SEbvn9S63BGGBOtVO2EsD0ugfH/JIyRLxj5M3Gb2l60xW+Uq38cB 1EBJlxbPorimkklOJ2dml0k9DpqvQNWtleGGHj4+Q+ovmkIph5RYHCS8E8L1tgPF5XTU BvAtcGGbYcuXxGNM+SR+gl1HQ2+YP3LYRHkYwOh058AbbgxCn5JLrkq1XDRXgkv/YyPr NNZnbCSYVqQrEytdUY6e4OlGSEvyb/750Pu5oRvxmulwcGvXlBD8n48BaiUYtVwcurnl 2fJrhKnuz7ftefUazDiTalof6tdPzGbj92t2Uceco4eZFyWgyfh0HpgDnhBC+B/Wso3Y YWWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240145; x=1726844945; 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=hxV+xEnMJ80gLhFAUliu5RFc0rPgxSLDZdSiAt5SbDY=; b=btO3In+sthG2C76FWb3Q6pRaaSEFiDYSNp90yMvgiJzP2Vwrk2ZJhOXmdVkb5+1CDm bGe8ikF4LNBOGtbdwKnbHT4ww50+8osEkYWmpLFkgGTgT8h7DDiWp3XtiyesgIcpm9Yd kt2cvT+PR+tY+ESq/Zc2tTuRts5iGWTkFmFuXPF9xKFQF3dhreZGzigmZUvUr5G9wcpN ERUlScvorbA4FRTx+rwtAwGaaIrPQY12a6ZSBJ4pZBGFN7ULKHL0cRE7roTx+OAXSz3Y GMtmsw69478nwX8UKKwhbIeSo95o9Igi7KN3a9af9qGQsrbYhhA7D/Z8po+XrYRo8o/6 bOkA== X-Forwarded-Encrypted: i=1; AJvYcCUAj+qhojwK5PW6aK1eIVQDYtYCcdt1sORYCBq5ofjXs911kHFPtvK5+YuUJCfcon1xZzf0OtBHWcbexWoHBw==@vger.kernel.org, AJvYcCUENAftURWFA4zm/sme5z3Lze2KPQy7m3ah4jztBYWJSBTOAJBJ1Lh7CPNwii6wsZfo7cUnLdoT8QU5tRRLfSWHBbA=@vger.kernel.org, AJvYcCUG4BdB6qYvZTgMErbrbA3iYvPwGQEkCWkGkhQo9Jjooxn1iVEpmKiBgA8h3t9ZDhcAap6qpgqnsONqYko=@vger.kernel.org, AJvYcCUe01Jrq8t0mz7dzVh45z0x2YyDeNKnesDzA2hbcIUv8/FNrtvw/EHimugR0qzlZhAU4Zhp4XipXYMGpt2k@vger.kernel.org, AJvYcCUqmW0zIXwe2TRASlIo3yMV2IFHqeyjgSIeaPOwwwTmskWxOaBQM0eQgzTJxnISExbQqTecMsc2K3eR@vger.kernel.org, AJvYcCVDhgRfU7xlaxnWje/pio3DeNi392FW7mh95CuqwvKFqIc0ZXeZ2F0KashExvm42GtAVoCzX8GxCU1+gg==@vger.kernel.org, AJvYcCWws/1XFdt0fnaiw/gig92Zqq1hmjDqLAXPOARwLA4aWAp2BPgIp3Oo/+RtTnAMgfFtHoftLoEYE88J@vger.kernel.org, AJvYcCXWRMAeJoGvSx7pOz9vQ/zGYDAJ474fnfQFzHqgQOluBCUXigT1iYQsBmhRO84KzIxVif8X8oIBWiss@vger.kernel.org X-Gm-Message-State: AOJu0YzdhDemztQ1I6PKj67E71CiourMqtcXFingxrCQqBwRDUJwN2dB dyce2FXttD/97yhqnFea/4oBrYARjG9ICRVduHAcPKSCzvUdtqAj8YHNyA== X-Google-Smtp-Source: AGHT+IE9SU2tpS2E9sl9JrjbS5UqYQlYYcA71JF3FE/gLt/fekYWBC22Y8MK+YXR/Dgfn1wLaGW9/Q== X-Received: by 2002:a17:907:7fa9:b0:a8d:2281:94d9 with SMTP id a640c23a62f3a-a8ffae028c7mr1249506666b.23.1726240145089; Fri, 13 Sep 2024 08:09:05 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:03 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:02 +0300 Subject: [PATCH v4 19/27] arm64: dts: qcom: starqltechn: refactor node order Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-19-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=898; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=LXgqSMJKPpptWHRjG5sGV+9Z8Lxj5jA8H20WF+m2cbs=; b=ccx9XcsXSNXZtx3lf9Znb3XeO7LO64xR3paL5EbWRnSV/g9CK+fRNlh33SCZEmc/R6lgJx+Yv xyj90eigHrvDNDCg5PpJ/w03ex0PS4D+JyOJ025QSdAmZbS3+VaT2iI X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Fixes: d711b22eee55 ("arm64: dts: qcom: starqltechn: add initial device tree for starqltechn") Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 2 +- 1 file changed, 1 insertion(+), 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 f3f2b25883d8..8a0d63bd594b 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -382,8 +382,8 @@ &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>; From patchwork Fri Sep 13 15:08:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828673 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 F1F65185935; Fri, 13 Sep 2024 15:09:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240151; cv=none; b=SAzzLZV9kpuvX/M0aKaJqAE6k88/guIVCYC5QLo1S9uAisE9ZWCmQcF4TDoHaUR/qXXtdIE076TF+yOKFH6wLFzpCt+honAc/AWHFxVSBuoUGWYv3M0wK8OKHTIg0SfxUYGuYJ1I57Y8bOw4R4eXp/5OpV1fdO6NoHxHUfffF1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240151; c=relaxed/simple; bh=v2ECB5b4RvqZNQX0iHQLIiWI4r9KcdLBWF4yxk3AOSQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kbd1mVPMsgnfVF0+zyKySnaA8msXoLsF4B1cyCYV2BPLQTxgzdzyFddEz9XWNLqGeC6enFi6OJiQUXZCnI7xAZP//rEULWjm78qmU4fz/1xsP3HZSyrJdmkPhJ9y+ctl7lYoqniUJFYN+WK08rEgVscFsiA+HB9LTWVYAloEfRI= 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=NWs4o221; arc=none smtp.client-ip=209.85.208.175 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="NWs4o221" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2f752d9ab62so12227591fa.3; Fri, 13 Sep 2024 08:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240148; x=1726844948; 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=55ASwlpj93CUVgS/uPubEqfpV10Z+LfDh1X/v5EhTrc=; b=NWs4o221nBkCsWgtKoECYtwJ8xJfCIg+zRoz27wyH0II3wdcgCYpLUFwLhjq8Q6hty Qe7VzohsNkLAmj0NN4j8YOQPzuzkEXou1I0+RvRbo68abo/Ykr2zZDNqB5O/sPUIoxVU jOKfo+mtFtG+gjpcJc1nGV21NgSQtP1vCcf5wJj+X6bT0CdvHqc9JH96aeeF86kSYCWE eaOt2f9iozSA96hVgjVbVZvc8nJnqLTQl46hXtpJbs1sCvlZ+shF9tYFRAUk22zatfjx u2aL7Zqbiy89bn//I2cB7lVxdQlfjYIJ6wUIPDHgJP1vFp+AtJ9KJ9ExRnSKFduG7O+4 hveA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240148; x=1726844948; 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=55ASwlpj93CUVgS/uPubEqfpV10Z+LfDh1X/v5EhTrc=; b=SohmWlPAwUhF1al2yItX2MRKHlhc2tUL/MuujmEFGB6F9pOkP9U//nUkPM0Q5/YeU+ 8u9nd3QFzpl159TCAweHxlYyFJhSVVcwIn+soI9T0hRy0SOAg4naBD9HMCzNXkqY6Cgf SNYVnEvdfD4AZfQOeMilB5p1xf9nmBzpNpQHz7Zd4PlXh1Ydp+LUXhZw4mxpYbG3lEYL rph0boeyUtDhKnpdvbQw+/Y46Wbt51sGgvy9vEiSVS3AYTdHWeAaHHIFLT+S4kPRtARP vTo55ZP3f90KSpBLjrpKylgkYmeNZOSyHLZ5N8AKfaBuqxWKCSe7a453fOYHzO4tCCiH gU5g== X-Forwarded-Encrypted: i=1; AJvYcCU4PpV1LZhNdJp7k6kyUdbITsbFjUs3LRVHoaD7ziTwqnI7eU1BlwepGy54htMveUKU4/xw9dxwU6k9@vger.kernel.org, AJvYcCUfT8nO+u4GAaO+Xu305QqiS8uV5S8oSZYGejmCKWdbOZGD7rZe8puU9Qe+Azfm4YrVlo1KOGGGXU4C@vger.kernel.org, AJvYcCUvIxMTGkIs0YY1xPj7qGbgGeSs+irLzRA5BwkWLEUq2SK32rCgnGAFpVwIOyqFt1jBK/fO2X4Q6GspxjeV@vger.kernel.org, AJvYcCVBGS67PyUNtRmFAMd2BzetKUjLM0bGOokg4hTH55Sl6Zsiu4mVoEXxnLN6/yoRM7yMdsKkC0t1mkg5kghGgRxmxa0=@vger.kernel.org, AJvYcCWij0RFladrh/jVPzIDfJaSevubP6qUhL1fQEDiMKIHKN4qb5H6/eAgHrV4V2CNMlxJw0x1HovVynRO550mCw==@vger.kernel.org, AJvYcCX2KG5xaudZZiDVutiT/Lk2SD/xmGrHcidNiSrZin+mq1Q8d/Rp8S4BJd1PId9KvIoE2X0ZfYW4cB3r6Vg=@vger.kernel.org, AJvYcCX4dI/2mSIcBwfKtv2Dp5pP6LTnVLeQn8f1U5emd5uwJowyMrJg4AHYsFjYGPZl/vTJ9ADRq+igvM6Bzw==@vger.kernel.org, AJvYcCXaCB7YEvnqQ+/JpmHivqC3HRxv4Vbhp5e+Mcczs4NAiwPn9BYH6VpqTd8hS7qZ6Z72f2UzkaxGnWIx@vger.kernel.org X-Gm-Message-State: AOJu0Yw7SpG8aspAbCBgUSI87PdVXyw7xblMGqqbPyTRVD4d01SziMH2 /hrHj/qmZcJZLELEeHlKFshYX4yWWU5ZyW5H6P+v1rZc6cBgazVDSsYUyg== X-Google-Smtp-Source: AGHT+IGTgrigkN3pYFgry+y4pbIiHE6qcSI1txzxF+Y/VDsmiKk4E4issoAeEk9L+DNueAZu2NHRsg== X-Received: by 2002:a2e:a99d:0:b0:2f7:5239:5d9b with SMTP id 38308e7fff4ca-2f7918e095fmr18494721fa.4.1726240147864; Fri, 13 Sep 2024 08:09:07 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:07 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:03 +0300 Subject: [PATCH v4 20/27] arm64: dts: qcom: starqltechn: remove excess reserved gpios Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-20-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1067; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=v2ECB5b4RvqZNQX0iHQLIiWI4r9KcdLBWF4yxk3AOSQ=; b=4rmtARmU2EIXalBZ1YEh56okxvR/WWLGICjzf9qlRYTxw4Wc2L5F5ymCc5pFjSqPbYSbY8eqF A4xNCOKo9FLCLQtQSVVyxjvBnH72jTVfhz9UR6iFZq/Bu+mqtgmcbo2 X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Starqltechn has 2 reserved gpio ranges <27 4>, <85 4>. <27 4> is spi for eSE(embedded Secure Element). <85 4> is spi for fingerprint. Remove excess reserved gpio regions. Fixes: d711b22eee55 ("arm64: dts: qcom: starqltechn: add initial device tree for starqltechn") Signed-off-by: Dzmitry Sankouski --- arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 3 ++- 1 file changed, 2 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 8a0d63bd594b..5948b401165c 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -418,7 +418,8 @@ &usb_1_qmpphy { }; &tlmm { - gpio-reserved-ranges = <0 4>, <27 4>, <81 4>, <85 4>; + gpio-reserved-ranges = <27 4>, /* SPI (eSE - embedded Secure Element) */ + <85 4>; /* SPI (fingerprint reader) */ sdc2_clk_state: sdc2-clk-state { pins = "sdc2_clk"; From patchwork Fri Sep 13 15:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828242 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 EC91354647; Fri, 13 Sep 2024 15:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240154; cv=none; b=GsUp6hyEXBcokfCfqJAgBcSHtzZZQCzj73bxkM+UrgDPWwF+nRwieycUwvJPsEagVqNDB8WBweuVrPDrnz1iOq0e23xaAck5/T+0PV2Z/XHEjRzFaEjMW9llb8LNf5zWSYB0FdxftTZ91mzhRAxHHX3Nuj+1AA5eReYQy2PFfOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240154; c=relaxed/simple; bh=o9Qd/8JMpOJPQYcP3TU2sS+epu62uYpYthXa4YYQCgY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cM3n0356CNWUOcfs1bgEnfJfxZzvUakWzyMEi23tKwvXSCuM0UM3x9KSnQ8GyX3QV4nJEvqNSYfNyin64+F0hli2Y1bJFIA12HniFQg2s7W+Cp37I2+wfZ8FD1z8OC8JvkO0PyCxdGR56wx5awun98gXHObmouuAZbHdGs7lTeI= 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=ZEYJ1wXF; arc=none smtp.client-ip=209.85.208.178 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="ZEYJ1wXF" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-2f75c56f16aso31099701fa.0; Fri, 13 Sep 2024 08:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240151; x=1726844951; 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=BqCw/4kHuYfS+tegSJD+cV90aIl+wTusfRyt9G+zPuk=; b=ZEYJ1wXFUxdl3fXh6VxMD8/ucZuctN+A/jEq3IsT/BHvlHaxoxOXcBu7c7YNT2yMOr XKM8AfkYudKj4upLVTK7Mf3rtHko8GroW4wGhx/dgnPVG1g4soZ3FJ1lNw7uTBOzVdOt 4hyjMiQLUkiXV/qBC9Gu9VNNHl2qFuSQEWF0uTb9ZkMivdBBkOjLdE2286ZbsRFd0C21 CRoYheZDZCQo2ZtY5RwdXtFna4nyWRkAZj+uVUrDD3+yw1skCQUiSmmxu87rqYKLB0QJ +RP5JaORAvuhP4RFAAxQoNE+21wBxy/QVYZvsdDE0dItYVpis7hV7OlLAd4d7z1tCaSO 01ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240151; x=1726844951; 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=BqCw/4kHuYfS+tegSJD+cV90aIl+wTusfRyt9G+zPuk=; b=G8hrOKfUh7tKlRJw2qO/N2PBXZ9bF9BYFV/B2yq8dcshFb1gfXH5217VN9GNDNckpL LEyKw89d2JDwWuRVrdLxI4UbL2XM82Stl301RMvaBtdBQpZdXHk+qTD15EKcHNs2z98z oe4JK20Ri1CsDid0a1blD7wwtP+yDRbWqne9j10LXs/JVnMReLFvBChavcBecaR3qEPK uNAt6fGJUIQwdek6NitKWovPh1wJXMTsPfW8X7rc5Q37QyPKYTaPm1If7HbXNlQW2T+o yZ80lslNP1hXWGWwoUm5mRjqdXVVngOgTNpBqrcBkzPfqErC+/v71nSB6rdFUDKcZD/w 4IEg== X-Forwarded-Encrypted: i=1; AJvYcCUV/D/djQPB+q5edLRj9MIyUNHY/TxV+mJ89DbtTYnjJ2IAmBR+ByxLT9OKI82PRvpaTrpIsLzE7/LnLZHbbQ==@vger.kernel.org, AJvYcCUa0d460KDL5oSL04F9C+1USn35MOQzXXmwJYOl0UIYilW1TOaniPAEz+geimwJH43SirR22ikUKfLy@vger.kernel.org, AJvYcCUe3Cy9uOBjP5QVf6WQDL5OEE5nXcH2/Gq25T+rKe3FqS1p1cfIj+VvXQ6vAepuTsN0FRpErsSvw+AWDw==@vger.kernel.org, AJvYcCUfTvgBzM1t45h+azer4JpimECl81B73GSjN/3OgdPj+1+xqf2GYPnKWKtqvAwmQgSPmyBqejfvAVh5@vger.kernel.org, AJvYcCVC07gJ8ORuv5/6oQRGZgDvoVT5qVRFhQTY4070iHfJ+D8yv6mcXKmB2SshFObNu3TZmoBDfzW1NjGQg7LRxqqoetI=@vger.kernel.org, AJvYcCVeIu5xJMNnbHWyElbd9uG909m5uDtMiag8ZN+LEiKjcIlZw1EdPwU1wE3JW6FEJS3wUaAHnCmfpUVg1JY=@vger.kernel.org, AJvYcCVpdVqFo2T5LVTeCrVLA2hlLQCcWuQ0UTR6YfO5GkVutFT7if4yulEUGK8+kaGpLOdl0FIAplwhC7ss+Jul@vger.kernel.org, AJvYcCWH88PIgs+RKVzV05NXUmJhU52l4/+4f/FzYviOMtEhFGQgPqn5R/hkuX9Xi7r+ERdM3ysdjl5+RdoW@vger.kernel.org X-Gm-Message-State: AOJu0YwFqIwSHrP8L7bqMiz2m4B60NSBbj3h5etL1kmTO1sIgHIVGNg5 fwMaPbAXl6e/qQD8MAIJc1TTNv0I8lbY0dJulv3yP8v5HFvrNTYiO7OZ6Q== X-Google-Smtp-Source: AGHT+IG1Q7xjN4CCu4u9SogSo32R938De4uTV77FDjfykgt4K+bzKzlFr+lhvVtVxKIfcKXPkEja+Q== X-Received: by 2002:a2e:1311:0:b0:2f3:ed34:41c9 with SMTP id 38308e7fff4ca-2f787f32dc2mr31568371fa.37.1726240150365; Fri, 13 Sep 2024 08:09:10 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:09 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:04 +0300 Subject: [PATCH v4 21/27] arm64: dts: qcom: starqltechn: add gpio keys Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-21-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1745; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=o9Qd/8JMpOJPQYcP3TU2sS+epu62uYpYthXa4YYQCgY=; b=Gc/pkDKuxyPTs3pg3UWl6auHuVwfoE4b3u1agqq5dHZFsSc4ONRWz+4NC93OHSJAhu/oPayI+ RcHdt2uTR0FAbMdall9kokXqK0okx2IEy8ANaIXU7dyWkzVKYBe1gYG X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for phone buttons. Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 5948b401165c..a3bd5231569d 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -7,9 +7,11 @@ /dts-v1/; +#include #include #include #include "sdm845.dtsi" +#include "pm8998.dtsi" / { chassis-type = "handset"; @@ -69,6 +71,25 @@ memory@a1300000 { pmsg-size = <0x40000>; }; }; + + 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>; + }; + }; }; @@ -417,6 +438,21 @@ &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 = <27 4>, /* SPI (eSE - embedded Secure Element) */ <85 4>; /* SPI (fingerprint reader) */ From patchwork Fri Sep 13 15:08:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828672 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 AEE2118FDD7; Fri, 13 Sep 2024 15:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240159; cv=none; b=TopdIk43mDDAavsB+Ksu3pKGzKHUMX9xtBfgyyfc08V7G1UUaVqh2VcFzhxQ4DO4Zj/c6xprt3YuM7ImAG4Ff/xUw1t/HSrRx+xcCc1UrRyIHqPK59z1ncTzwYzvnZ0cPUemjTHofQ/7eglYbhv/aMNJFrtD5HNmZAWC2rp1KwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240159; c=relaxed/simple; bh=p7eZaA4h3yztijkM8JFf5ob4Unk9CxIwdqtw+LwA+HA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NOLP4bqrGYp4tUx2MniUAJ20MVa+A2Z3Teh+XI67w0AuRb6hh1B6krt2jdOiKFFu6r9Uu4zEXXkkHsI+wFHDctWjuakz7NFxlkMMdBIzgKjufEn+WSRlVk6LXq8/9EDvJLl1m+Rm5N1EOXAoDCKJa9BrNz5jz6T2RIjydF3+UUg= 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=iFudbJvi; arc=none smtp.client-ip=209.85.218.52 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="iFudbJvi" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a8a7903cb7dso60337466b.3; Fri, 13 Sep 2024 08:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240155; x=1726844955; 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=WJ726FEj57/R1QW6ACfpQvWc4FsY/5U5BsMP7VDxoEk=; b=iFudbJviorM31+Bk04l2XOTV7W4Hpi1H2DUM1Jm1GWA1qXUEW7B3EIqMtqILANH/6J w2MkPe3FQisSNbqJyE9tptHHM5rA7wsd3wyE3KqDGkaWp4XgUEmexG9J57NecAOSPxHI zmo0bnmJba/PAPdqiOOhYrUYmoLbhlhuEDFoCeYwb7tD4S3CTAbpwagHJbgPD8dK8yR+ NnKHHRqwdZPnkvms7DDrc0S8UZQOQXfL3Fup8Lsezx1dZ3nWJyilJAb80kFXhpZ6l7ub YJfwnoSb34IMFqll09VHxJbtetTTaLwTMqV3vA1Womkl0MI2AJt2F3SkOENzRW/aD4Eg DrbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240155; x=1726844955; 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=WJ726FEj57/R1QW6ACfpQvWc4FsY/5U5BsMP7VDxoEk=; b=qRYnnSc0RPM7W4jZEf7AnEzNbQfpWNDX15ckapu+wFo1fWNYu0zK2yFD94km4Uy0df phcgJfSR/HYKeL3JBCv62Bzv7Wgfk5IVLKMHr6E6awYtt98U4yKochcA1LdzTWknSzOt 9XR/jlFyfqhuxfPmmYcIa7nVW3ELsxqMZCkt0VGD1ObrfCUyd+BoC8yZEamUDhh04mxr v9F4qyzxvNCdaZ9JtusJkH1Q6UnbYUb+j47Ae+9WZ91XGxZfxpz4exS1i+llE9xrZqGe Mk+oWjR0bL/bH0S/nzqt1+hk5jPHLYBWGVS7TkLPkMXrhME4k+hCWcldeBMsIGm/OZdj 57/Q== X-Forwarded-Encrypted: i=1; AJvYcCU/zBDpQQ317kTYaW7s9apjiCTIS4DOzJtNgQDLwL+RTRpWONZ6j5Gp9hU5uP1cECj1R11BsH8PUjV3@vger.kernel.org, AJvYcCU2+vW785AlqvMZPYaR9tq7aGIz5Y8nT2KELYE9CF4UeyrplBp544k3DYw4IrkysRsLMYSafHPg7Hj+@vger.kernel.org, AJvYcCUMFCOxSFpha8xbFhFWimi+pmdVWNGRQ9hPOEx9b1w9IJzmMSap7MopJmcgip08Afj8j4AKtWs41p0Fbw==@vger.kernel.org, AJvYcCUvSPC1L/Azi0NbU3yBcBh3oh1qOEqU8ULgmrunA3Tnb8HR7dJ7ejw+mEFJ1lLLFR9e9/K59pUV51jpiBExSg==@vger.kernel.org, AJvYcCVH4hZWmNaj8gG/wP67V7LVxteUAkmJXjb0RpkVgxJm564upoP5Z+UHuQlhGd1Crrdi3eTugMMTd8rf@vger.kernel.org, AJvYcCVKa1dU5/66Zw3t2FOKWX1eWiAz0SPTvL7qgNkeJEgqt7qqf7BrOZitfubJlfcSOtAEGQImdRXFhTAdg54=@vger.kernel.org, AJvYcCVmcqX4D3Y3gCn52PERtWWAkdYrG30HMuoA18VgtXmSA1/gI8/j+Mwk0raP3jEbZd2et510CXFmPyVM1mIhT9dmllE=@vger.kernel.org, AJvYcCWPWA7223pqWLkrDIS/2eni5uxGNgAJzuEZftnlr1EKJi3kGqPLDQikk3t0/tuLebP1FfQLCdTA0IaKYZ9W@vger.kernel.org X-Gm-Message-State: AOJu0YzHKSw0qHK6JOQtNXjKEcooKcl3aELpOMQ1M0YuRNV6ep2qvh/U GN3SZg3tCKHvb35HvfzCnz5qmy/69jGtRYx9d/bTRPeJ8BKfvfReQ+DPuQ== X-Google-Smtp-Source: AGHT+IGbWJlyYcTF+ffZxNKKAxILQEsgpMR15i+Fbqpth5IfaRpW0PZ4FN23j11Gq0H5O8f6BLvrqQ== X-Received: by 2002:a05:6402:1eca:b0:5c3:cb56:e67b with SMTP id 4fb4d7f45d1cf-5c41e2af60dmr2838183a12.35.1726240154887; Fri, 13 Sep 2024 08:09:14 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:13 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:05 +0300 Subject: [PATCH v4 22/27] arm64: dts: qcom: starqltechn: add max77705 PMIC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-22-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=3533; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=p7eZaA4h3yztijkM8JFf5ob4Unk9CxIwdqtw+LwA+HA=; b=sdmst4ZjHx4WBMFwaH5sYpxzuUlyQwoYFynueV8VOADBU6Zor6CgrUGWRItdc5ujNdlCYmr7X +kp8+qPKBdtCSdNIMrP9DZgeC0rtTreg0KpBQi5EMFj6+FzaKsokgP1 X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for max77705 MFD device. Supported sub-devices: charger, fuelgauge, haptic, led Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index a3bd5231569d..865253d8f0c7 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -18,6 +18,16 @@ / { model = "Samsung Galaxy S9 SM-G9600"; compatible = "samsung,starqltechn", "qcom,sdm845"; + 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>; @@ -90,6 +100,27 @@ key-wink { debounce-interval = <15>; }; }; + + 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>; + assigned-clock-parents = <&rpmhcc RPMH_CXO_CLK>; + assigned-clocks = <&gcc GCC_GP1_CLK_SRC>; + pinctrl-0 = <&motor_pwm_default_state>; + pinctrl-1 = <&motor_pwm_suspend_state>; + pinctrl-names = "default", "suspend"; + }; }; @@ -385,10 +416,66 @@ &qupv3_id_1 { 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>; + 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>; + }; + + fuel_gauge { + compatible = "maxim,max77705-fuel-gauge"; + monitored-battery = <&battery>; + power-supplies = <&max77705_charger>; + shunt-resistor-micro-ohms = <5000>; + }; + + haptic { + compatible = "maxim,max77705-haptic"; + haptic-supply = <&vib_regulator>; + pwms = <&vib_pwm 0 100000>; + }; + }; +}; + &ufs_mem_hc { reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>; vcc-supply = <&vreg_l20a_2p95>; @@ -485,4 +572,20 @@ 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; + }; }; From patchwork Fri Sep 13 15:08:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828241 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 93EB1192B78; Fri, 13 Sep 2024 15:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240161; cv=none; b=r66W4Q/AlOFK2k4KV2oesVlT2U6q6f+aC8NI5yy5Tpe6tokDzD5kcGDqldfzzWcnQpZyflkl69ODNsa4/ZdEsMj2ld0Y4Xkfl7SGq/YTFNye3cejoDFGU8EA017BGUmT0/hUAtxgGLRLPuXMIztLoYCSEIoJ9SDAo/X8kBVDZ24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240161; c=relaxed/simple; bh=B0sd1Gx57GIbQM0BZaCzYGyV/pp35NQhF6ldvlao3X0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NDewVFEiZNSYO9v85svxIaNIFII16KWq/lEvRUVd3k8c+6ZbgVIUd5YAqg9+CTf3ukPVICiCNlVH8IHru9S8bYmqUqdhUHsdZYzya1+lSCd9pZeytpb5IMXedTkbHkEQN9b+Axa5rhKs4yFB6TyAVAA3ru4j2a20HeijohA2QAY= 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=l8i3J0Tj; arc=none smtp.client-ip=209.85.208.50 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="l8i3J0Tj" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5c4226a5af8so888196a12.1; Fri, 13 Sep 2024 08:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240157; x=1726844957; 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=CfgwI6EyZw2/O0lD30k5AoCMwqQKhtZSyo8NYOTmFvs=; b=l8i3J0Tj2mRFGeAbQdOVGQd0I+aX7AwmTcI7PH4ZOk4uJcBq8YscoRyvJeEskHEx3g zRU7EB8hwjH2Swzpsv7IqjNQT7FBbxh4AI1dVJviNsfjVsakrhdAtvm/+Ty71khUgfEW VMKIFd7TlPeLHG9fCqagBQvj5UQUcV6A2l3NlbZb+1njyBTUY8heOUtggimqpJLIuqtQ 5k4o0jGiWdljeoTCX9xifXuq0QuMM2mCc+lrteidcZTw/vZox+OZCq+EDVEjcVfhmIRo z8n6mWB9BkQZMO/KBu/r38vyZC1qZ7dJ5wWfR9MbtvLEvGgDUVPVPqynxYLNB7ZGk5qY D15w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240157; x=1726844957; 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=CfgwI6EyZw2/O0lD30k5AoCMwqQKhtZSyo8NYOTmFvs=; b=Y0gmxals0ds08YWSrknjIN+8mQOJ1EhXeSKF6tJ6+QuAfuHbKiWRt/0+DbXIXZvOvV 9NF2QHWTYyVMQ8vYYSVU4YZBmcpBy933mmcBfgIE84K8OeiGCXFYuqmS9R2lgh/7qnFI VMpwjrZYDim8T9QGvyy7t792MU1l1G270YJJda2UKQbu0COhtYKscWHb47CtlobFHLcM K8GSXXlyS2skT+KjxOM0GWoHmUCBHLYaaPSTyyuE5iLyh3nfr4T5IndgRowItDFq1Fj3 EJuirRsnz1kL8/gBl+WiU45Y2wXMUXTs/Qjk5ZeZ/Xd5Q3JlB2j8x4vRsetGagJBKPhF Vy6w== X-Forwarded-Encrypted: i=1; AJvYcCU8coZ40Od70F3SYxH6qGwFbQsENc6fh+ME7P/C7ffsESmkOQVHhGuP3x2t2ELE8azn62b22wcgh3Xk@vger.kernel.org, AJvYcCUwyZSs4a0GZLy1XfxbhcPYUPPb1WgEpCGODZosRe3rZwDtW9UJ83dQby6kszl/nsZOWq4bx7r0i7A5@vger.kernel.org, AJvYcCVSTrkDhdCGAwLjv7iVM1tvpXLduY8rdMsju40PvUISRD9V9x9d83Ddfko/hBuR6d02yfyr06rI5dtc+A==@vger.kernel.org, AJvYcCWZ6sY22x43GDTZ9R67zibcZFRPYOsK0dtNnlUepwdWkhaDlQWK6ZM1Uxz8DfldkxuKDbx+/iA8ogruFNLpYg==@vger.kernel.org, AJvYcCX/Mrb9PfOQCsdlVerd4fJP+sN7VTe6RxhnzOQ42KaeIN8jzbr8jz0JdMrk9GW4GH1HicI+hHuFOAbMnv6V@vger.kernel.org, AJvYcCXEGnFaHdndfGsJqMZbad78VaQTUMZvMoYlcqLCcAFolL1AaO3k+Kjr7iFm56ZpUbgp6qkRptjIZEFWxko17r4gvSw=@vger.kernel.org, AJvYcCXMMy5r0QDmBcwxf+Ce6cNSqdtKyYE9LGokIMlGUtpdlx6Nqz0xvsdyJGzlG1Wy6EbHPKq5Hj4HiwGB@vger.kernel.org, AJvYcCXMbiycKNqL/cNQQhvvPHFnRWoHHCViise6ir2wmf1x+YDEI07OK/FtdjHbPmP520k+eTG+fUiYkS87RKA=@vger.kernel.org X-Gm-Message-State: AOJu0YyS8Bz4nO53aD5eBLPpDTVLO3m6xfQJmmWMdkWXalQalYOMEx/H uXdgBpHQ+VdqofisuwAmdgGCIP+vfGy/fgAVFzXFCEzSaM+2lMk3AVPGRw== X-Google-Smtp-Source: AGHT+IF0OxyUbB6FJHD8McDF5ty7a7zew0Jhoux110abjXEGOrNTZK7ycGjZ7jao9Xga6RTaqep0tQ== X-Received: by 2002:a05:6402:2550:b0:5c2:4cbe:ac1c with SMTP id 4fb4d7f45d1cf-5c413e08a4emr5599000a12.4.1726240157337; Fri, 13 Sep 2024 08:09:17 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:16 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:06 +0300 Subject: [PATCH v4 23/27] arm64: dts: qcom: starqltechn: add display PMIC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-23-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=3073; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=B0sd1Gx57GIbQM0BZaCzYGyV/pp35NQhF6ldvlao3X0=; b=Afsvb9SybbZRXgS6pDW1Msrxj27/iqXUOQG+exL3XbRxXnVQd9hzOq6RbxjDrDtamcCt/cUDO cRXRD3I/PhVDmHOUmC0zcsYIToSuyUPXJIhU8yCC40fmyCw1aPWByVY X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for s2dos05 display / touchscreen PMIC Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 865253d8f0c7..5e5684f84ffb 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -39,6 +39,9 @@ framebuffer: framebuffer@9d400000 { height = <2960>; stride = <(1440 * 4)>; format = "a8r8g8b8"; + vci-supply = <&s2dos05_ldo4>; + vddr-supply = <&s2dos05_buck1>; + vdd3-supply = <&s2dos05_ldo1>; }; }; @@ -101,6 +104,66 @@ key-wink { }; }; + 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"; + reg = <0x60>; + + regulators { + s2dos05_ldo1: ldo1 { + regulator-active-discharge = <1>; + regulator-enable-ramp-delay = <12000>; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <2000000>; + regulator-name = "s2dos05-ldo1"; + }; + + s2dos05_ldo2: ldo2 { + regulator-active-discharge = <1>; + regulator-boot-on; + regulator-enable-ramp-delay = <12000>; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-name = "s2dos05-ldo2"; + }; + + s2dos05_ldo3: ldo3 { + regulator-active-discharge = <1>; + regulator-boot-on; + regulator-enable-ramp-delay = <12000>; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "s2dos05-ldo3"; + }; + + s2dos05_ldo4: ldo4 { + regulator-active-discharge = <1>; + regulator-enable-ramp-delay = <12000>; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3775000>; + regulator-name = "s2dos05-ldo4"; + }; + + s2dos05_buck1: buck1 { + regulator-active-discharge = <1>; + regulator-enable-ramp-delay = <12000>; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <2100000>; + regulator-name = "s2dos05-buck1"; + }; + }; + }; + }; + vib_regulator: gpio-regulator { compatible = "regulator-fixed"; regulator-name = "haptic"; @@ -588,4 +651,18 @@ motor_pwm_suspend_state: motor-pwm-suspend-state { 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; + }; }; From patchwork Fri Sep 13 15:08:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828671 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 0D4E11B1D50; Fri, 13 Sep 2024 15:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240165; cv=none; b=Joo1/oOIPTlwmSnNslkWtltSAKGUd7Yt8CqVX2Eta36endPg10F8eGDvva2jSccHeUYDxOjnrVQF3HMrNPNm8qaJgdXwLWQjFBcSNDi8JNERqQ9DBdvA0zOcOXcV08xfV9VWLNpf2mKELuvX2hRGsSxZ0JOCqcC04GB94mtcCdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240165; c=relaxed/simple; bh=xfKPhhSb2zcxmRcgX3kYwVV6/9Weh+gAoxLXODpNqZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P6IvMbwCqLug6I4bbZjkJaz31F2AD7uB1BE51pwaNizV9529r2jR7TlL83QM0oJGpSFmm3xm5kK1xNHRMTWb/f+L7uyI8paWRqRx1yIdeUXgLoj63s5hQuTCyrvnU2s4593Qp1Iy7JP+/z0QYk0tWxZV18mVqdN+Q+54ob8vb14= 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=fg962xSf; arc=none smtp.client-ip=209.85.208.181 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="fg962xSf" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2f75b13c2a8so27627591fa.3; Fri, 13 Sep 2024 08:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240162; x=1726844962; 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=5paN3POim0M1V5oFYfgmQMIz7bvdUVefYvSK6m+fUeE=; b=fg962xSfNSZE0Qiw7gzVgIUxBUS3IxTEE7hOv35wt7vHvEFPeOu4sY4Z8ZAoHv5eFl pwC2hUKikZz1/aY2f4HSEdIIhgvpqUjHxVlxTGyrmMxITVF2xY7EwkStFS51DN1l3QHX QvvBXRk0ywJEmxku1hA7L0XdWYql6uZo5DKLYoRSlKpn7txhscdOQ0UtD16r7+ZCSO8/ eNoa1wQ8+bco2aURBrgBTre2//LhZvCSpTbteszFFXiAGkSNA9W3OGxX7KXieVc+bkff 5K80Yp5Jzx8vyoOgZNo8IsVIv08/iHdBHxFbXEJtdqFXyQvJFAsv/nAcFgQ/FpHWw2Ab e2hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240162; x=1726844962; 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=5paN3POim0M1V5oFYfgmQMIz7bvdUVefYvSK6m+fUeE=; b=X80ELLrIt2mHF8Dk1tn3pSzGZyMseOETqVI+l+DhBGZZzGwLa+pM31clnQI2Y4l1pA NCnpnwgfnW5I1CnKdYSASlvANd017f0D+PC5NKYRFYVELT/zL1dcuAYascKtfu1Opsuw 3zBBHGjA4xzsEzquoQb7KIkDugPtjHw9j/KNPgrAg2lRhlk0SzIQWcT+6sPEMu+s8qCu 04l0dh1O4B5PYPMpL9K9CJ++tzXcUt2+99l4dn+g/wEnus4/VY9JsekbOas6MRePlyYf VK9kkCOK0tCeq0jQV662BzxpgDdsHkE3uwX38/9ZujC1tlZ1kYDBpPy5xnkDgdbsNwaj NFUg== X-Forwarded-Encrypted: i=1; AJvYcCU0fbQtoxK99HpmwKAoHbLbpEifi/0PJZXUSlYbwPP60o0pyUmB7Hs9XdJFUOmxr41V8sCj4ZqfG4Dec3E=@vger.kernel.org, AJvYcCUOWh42+pbfGnNo2t/9nnyHsbBHH+7UF/gXhN612HEt/iFb0cBNWSBmkVppAuzzUpJCew3R4L4pwoeIWS1SIZC0XGg=@vger.kernel.org, AJvYcCUdFWa5gkjdVq8AsPj7lD1jId6YUm2G2yLx4pMnDqgtQUuaPjOeJaqcopbgUiFX81kdsuT+rZIaUpTu@vger.kernel.org, AJvYcCUmvjNBDJa6LBiz0Ywe3f6lQULmC4gyUUHYaQrnR30KDU38nuCaTlKCfegLE1FrmNKLs8ybEgB04gy3@vger.kernel.org, AJvYcCVKW2Oakw5+LopAiPTrOUbkr6Ns9gqiAVOZatuUpBEiYTYQeUL6oac3drPNcS6i3EMcHRE2Co3exYU0@vger.kernel.org, AJvYcCVeSHo9N96vXRyIh3IyWZnS94fc/W4WNmrpNXdnd4S693qAI5HYmqbMefNURXtgKFsptCFLI5ZVM+OqLfvWPA==@vger.kernel.org, AJvYcCW9pyfOfvwsZRq9xIQjj1vkWOk0ur8FR4QAVf9OVqVVU3hn9fLlRPOpDXjJZZ2PObzHTctby6ToAgSRU8B8@vger.kernel.org, AJvYcCWL602P9TcOl6F+E842LD6vLNJ/xP7OxfMFMdW35nJLX2Id87Iyjz/1zKGrqp4SBhvpY6BBGU1Dh0l/Uw==@vger.kernel.org X-Gm-Message-State: AOJu0Yw6MKz+2p16q+DqkaQTpLPXwz036LqznAKHWUqSzLCAUOgmzHs9 sHZDzvbRItZGMGBB/Q2fwWzRyFVZ8cvhFjwzHP95Qz2GodMihF+3ZlOAag== X-Google-Smtp-Source: AGHT+IGOa3rG2/U+LVdvy0rfhL8MzbuMFEt4AJuYsIVlKUh9YYYMrgSmSQIgbFNhJgxCiHNrBCkT4Q== X-Received: by 2002:a2e:809:0:b0:2f7:4d86:5dcf with SMTP id 38308e7fff4ca-2f787f1db54mr34021521fa.35.1726240161793; Fri, 13 Sep 2024 08:09:21 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:20 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:07 +0300 Subject: [PATCH v4 24/27] arm64: dts: qcom: starqltechn: add touchscreen support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-24-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=1297; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=xfKPhhSb2zcxmRcgX3kYwVV6/9Weh+gAoxLXODpNqZE=; b=H2ABvb3Og7GioCBEnHoqR/zTsCMYCQ09poncV3dRTaltzSUC0uKIPjDC3H7LVXWeM8uWAM2bD 0/ZP2Q0zlJTASO7xLc4jt1qAZKXbOeEDf61wB1fLvdGeXfm2757FbeD X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for samsung,s6sy761 touchscreen. Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 5e5684f84ffb..37433ef74502 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -561,6 +561,23 @@ &sdhc_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"; + }; +}; + &usb_1 { status = "okay"; }; @@ -665,4 +682,15 @@ i2c21_scl_state: i2c21-scl-state { drive-strength = <2>; bias-disable; }; + + touch_irq_state: touch-irq-state { + pins = "gpio120"; + function = "gpio"; + bias-disable; + }; +}; + +&qup_i2c11_default { + drive-strength = <2>; + bias-disable; }; From patchwork Fri Sep 13 15:08:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828240 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.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 15DA61C2438; Fri, 13 Sep 2024 15:09:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240168; cv=none; b=fXnPCfKogcU0gkJlbltxYqTv8CV5wAO72Hk98Y6nSuaHF0cepzQ0+Ed7m9dVwYKbe8SU8/zL9vNjwdB79GPtoC4t52qRVL0cm7jTf8qM4+wgEbAAWXOJyl23wLaCB78GaxtChK6cMaqRqgXqNhWKTXUIHUXTqaIwXNyA24ni9xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240168; c=relaxed/simple; bh=cwfJ4ccvcYEzyYWYFd8BAOsLVSV2zpBW0R47/nwVpn8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bQLQmYTXX4eXS+zXA9u6AAMT5lU/8Eb2AaJm8eamEI8SghQ5SlGX+OnM/H4m4MXBuvL+ixXesFeaovmGNBqp1KyhPmpCdf3GnR8Jsiyh15TncLRr++LIKbXcd/eJlJIWzha7pJh5K+ivjt/bhwxUyErQLYb4b3InncubWT2q4OU= 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=dNlM6Or6; arc=none smtp.client-ip=209.85.208.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="dNlM6Or6" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-5c24ebaa427so5035868a12.1; Fri, 13 Sep 2024 08:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240165; x=1726844965; 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=pPLYItCTXlABQSxSeSNTPkYPdrS7WYB5A+2uwS/A0o0=; b=dNlM6Or6IY2mA9YIyio3WbaCS0e9VeeodyHwPXUwOPFDiWl9AECw/MDoyUAIQZDhnt UQimDFqNXKm9yoqrLuyfnRKUJG18wXfPbssex6J+M6kco0S0AGXqbwfRLkgElgqcbcaO puLrEVpy3WKAVd/OaYPMpIF6fx3N952rju8jE2DEkQhCOzVwvMzyy2IebvEUbEOpUsHh t5IZRAEut/F/iGjE3dEfYEs91oFme97+FZ9GH1lSBxF5hp5XAKPuip+Xy5su8mQx7iHT 4HW+2xPhBDnF0jnZuGk4+WRxYYDNTIhmiC/stFiyYIFzS8DC2NR+rNFkS3ikDEZFXJJa FsSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240165; x=1726844965; 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=pPLYItCTXlABQSxSeSNTPkYPdrS7WYB5A+2uwS/A0o0=; b=ehRWqvkhQs73LioQAyJsJa2LKuGyM0AoL3wh5ax8EAH2ZMprc4DokLi+EEV6y6Q2i1 7KYo2uplv861PXKmUQN31HGUqP2klEsgeFF3aABHNzGQdGT0ggeoq9GmwwlOmelopT4i SWLfxgQHAT+YmdgrEw3rrnSV+5q7AzMoLWZtUuZstjlZ33pfOqRZw4iTZNEGfXXl4+Zs hZlw6Ci5ZWVBLbySu1US9iUMZDyKFNJCnYoyPXAP5pBMNHBVR4nVZ8Z1RhSGvrFm66M7 AFeFVs86BxlydNa1k39njOTrZNeNKqrqYwnyDKK8snzj2DqIcyQxyxNzhQg03Sl+Gj7T Oo2A== X-Forwarded-Encrypted: i=1; AJvYcCUZSmXW1P23ErkfiRRSg0Hw22V5ofnSebtUnrVgwMWCMU2KoGjozYJBB4B9hFRU1PRKSDnpUKVHtauN@vger.kernel.org, AJvYcCUdXdVxo1XtuN/l5wic7rqMWQ/TEtzvztZQhGGCfRmraYEWsN+rDoWFqLOIWx7QH/OPHwm4A96N/E9/u+g=@vger.kernel.org, AJvYcCUmasMYiL2lAN11hh4mEueM/Xd4BKCaZ9z5uyi+m48eE8rXZpw4V6znEVxCjonIwPYwMYTT0j2NrfnMFw==@vger.kernel.org, AJvYcCUrnWrKIpFL/MJGPV2T1Tr6L/O85soWgwGQ97eoh4SlbHncY+3WGWPqtMluEq8wxCn8+LgghkOtZkbB@vger.kernel.org, AJvYcCV1w5AvkeEN3YWhHWpmP5xqlx79JBZPTvtudwjW43LArM5RnjyQgCkJmUiRwFVmZqo+tIJZ5JwT2lqM@vger.kernel.org, AJvYcCVniWytBWFqAgLtyfSmndjCRDQsSZ9xjuCbD5vB6MEUEWgPRVmWUnWW+J6YDsKXUkyJuDTCT4/M6E6opadAoQ==@vger.kernel.org, AJvYcCW5FkqwVMtrBVOhH0sitQaTWvlfMk5RrOVFHXpUYQ9EPUWYL1TkECLTEpelQeRKMHDGZXzYkEs/x/kPXTQt@vger.kernel.org, AJvYcCXY0JrCM+pLpusSA3Ya7lKNJPWkK+Z1bna3GwX+pNU5DZAUuu7MBOb0ydALwimmmUjN7ROo2FHfd8rlifAVnhyiO8c=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1icpKRM5KPqQnRYFlJCNQWw18GHRL/afv0zQW4Qs1d5SWG46Z cWSDUaEDCJMsL6gy/0wVvJ9JSmueVks1+kV7msflGwax8b8f0rym26lMiQ== X-Google-Smtp-Source: AGHT+IErbdJ28eJqWJNL5LSdaTaPINMhlHfcVt8rrpz5jT8XjpcKmpeCdv9t7/se8FEWso4bSJTP+A== X-Received: by 2002:a05:6402:1d4b:b0:5c4:1360:55a with SMTP id 4fb4d7f45d1cf-5c413600563mr8595709a12.7.1726240165158; Fri, 13 Sep 2024 08:09:25 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:23 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:08 +0300 Subject: [PATCH v4 25/27] arm64: dts: qcom: starqltechn: add initial sound support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-25-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=5097; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=cwfJ4ccvcYEzyYWYFd8BAOsLVSV2zpBW0R47/nwVpn8=; b=N7wpHZ0eUkaYh0uqAbHETEnp59jbrAkMDWPYI3nKUxfuBC99oB2/AeQtqyTHDOkfYo0Vp+4Pi L/9sGCOpfK4DqasNbqbLmh3bLRGqmTpZXdX288Zwn/AAAbTyQq4TGcQ X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for sound (headphones and mics only) Also redefine slpi reserved memory, because adsp_mem overlaps with slpi_mem inherited from sdm845.dtsi. Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 213 +++++++++++++++++++++ 1 file changed, 213 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 37433ef74502..c36ad043edf0 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -10,8 +10,15 @@ #include #include #include +#include +#include + #include "sdm845.dtsi" #include "pm8998.dtsi" +#include "sdm845-wcd9340.dtsi" + +/delete-node/ &adsp_mem; +/delete-node/ &slpi_mem; / { chassis-type = "handset"; @@ -83,6 +90,16 @@ memory@a1300000 { ftrace-size = <0x40000>; pmsg-size = <0x40000>; }; + + slpi_mem: slpi@96700000 { + reg = <0 0x96700000 0 0xf00000>; + no-map; + }; + + adsp_mem: memory@97800000 { + reg = <0 0x97800000 0 0x2000000>; + no-map; + }; }; gpio_keys { @@ -578,6 +595,202 @@ touchscreen@48 { }; }; +&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>; + }; +}; + &usb_1 { status = "okay"; }; From patchwork Fri Sep 13 15:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828670 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 9DF6D1C3F22; Fri, 13 Sep 2024 15:09:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240173; cv=none; b=Q5SO4RSrA8rIJcs8O/ZF9e3Z3HjrkiHWkXYsViAHBbDUV8S5AO6fvOT0N/3I3Q+K+XuT3iTNw9OoYDbP5qtpyb/vrb3v+96h99V/keA8p2LBL/AyqkMu/0cHzdkNazu14nMVmfEMXhqlGnJv+2nC/e2soDfQwAh6aPmj9FFP3+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240173; c=relaxed/simple; bh=FD1rljMeLn+151Vf5vciVGrZi3usPsZLEWnoi/tRPhI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V0FXiuJWIxtZzhoTRh+KDBWeNq+VGPFQMpCfsN0ACkg6YA9ALi2+1lLEJCSs6IcPfDwydX+EryBGdr4oaKuGT9VPBNZcZc1wuE6vPnMmSL4ge/s3ShPnQm65P4GSsEbWGyOdJ4+TF5qKowWz+DznMEJKtkgRvkUZsf/Tb4lx5pE= 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=isRo4JYf; arc=none smtp.client-ip=209.85.208.173 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="isRo4JYf" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2f74e468aa8so25739691fa.1; Fri, 13 Sep 2024 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240169; x=1726844969; 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=6fGinMsoxJHH1gDGhStsupCS0lT0j7DlavjBxipyt/0=; b=isRo4JYfkvVPMpm7R9RtjTzvFxvp65hC3x06NJAAuvKCv8BzWWqMMzYnc8icitUGTj KpebMqYwvjNzJhbfAMxeiS0UWN0aC8SCopah4S3nMAB8kotHWKXf2TBrz99Jz6oZVF6x cNAPx3Ru/vhDegUiNqvCfU0OYJ/go5Vshi2UDxsdxDnbexjFvlx/ZRkSXRxkiZsYbUP5 fC4oJ2vX6s6qtCKTEnDWSYFa6Q8WJWebhIzq4eBifSbPPTKFlt/FzIPg1fuFb7uEedap ZFv6teza7YFvDG3OoSTylt8y52beq2G1dNhm5wAvmtkFLXBSnRRCMaGZXbpLIt4ZR4Bb 6zqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240169; x=1726844969; 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=6fGinMsoxJHH1gDGhStsupCS0lT0j7DlavjBxipyt/0=; b=dH3HjwpSi9w+6P4VbklghJV7rio7GxsF+itt47+mEBXT8gLhbBcG5q1GrOY612B7QY ceYruVRHT/wMa0aOAqgFNIRXpdVqfZ34WErOwpghMm59JNd2C93To6S1UnS66YQ+0IpL Z6LX9Ij+4H+fR0SxMzEbH1mNGgh0yRUDsJ9JTmc2RIGWXB8PdhrdWsL4Sem6L4qqyl1X EwKfdQqhA2+B1OqPsmLAws6JJhHPusDxLybASo2C1hg743vTG5tkUZacT4/BiXHtUply 7wD3pdpIbY/ssb7KeI8uGbbc39xZrk/YCjhPkcJN3r5GEzzCZ4kMQm4lf7lI7rXLYFf3 ifNw== X-Forwarded-Encrypted: i=1; AJvYcCUoFT7/0XHYoewnfCphN1hjjC3OlN/wSlaIsYQAu0IEpE/OhgexXcIpfBNx98dDsllTCSohZ3QIuUnLefSqUg==@vger.kernel.org, AJvYcCUta9DiBumsJrt605wTpG2WZuKNT0mWQWgI0lHL4zUa6vlKJdqPtAd22V9SzsJEkNNb8HFDDnXiWl/JvwSdasSMClo=@vger.kernel.org, AJvYcCVGkHKnxxSkLoocxVxBM62KWlNgQeQ5vE6Cv01bof4Jh0jkXRAl+q5cmtnd+S03CDtGp0b7aRYzLuVIQA==@vger.kernel.org, AJvYcCVa+rl8eny9MvzX5nkpIEGinMEe6AJGFXp6uVth2pZy/+nsRLDkqYOeSpey1MhX3RppX25+s+4Gji8d@vger.kernel.org, AJvYcCW2LuE+L7rnloJejKhpItDn8xUfD9d3ovCCfAdqo6n9U+W0Lp5EMCqjxzJo3ZXfbQWLSAxq5q/2rKVw@vger.kernel.org, AJvYcCWVQzJxbfF9/Vp6+MUo2oXwg/XBRPwhz0czqCne+1RQuYo4DjrK/HQb59fXe6okalRW+slcIa0uur0EKjE=@vger.kernel.org, AJvYcCWZUgxYNFBLf3VBXBhS+eIiHM8URGcq/Gyuu1RK1BjB6faQ7lYaM00rFt8CO79HssbiELgO3RNjB65z@vger.kernel.org, AJvYcCWk0boblkX6LZM0UhQ4zlWOW/YCCj4DUJhxqyQjC49ON+l9WAWPb5g4jpnFTMVWX3gYwgakTipRzN3iM7wE@vger.kernel.org X-Gm-Message-State: AOJu0YybpkdblEVpHNfVDwUWlZrs1QxFa5SEYHhk/eAWrYLf/O4Z61RH lS2Qa3RPYXvZ1PY7v9v7g1DKWm1CpxZDR3HYjbwXM9ngbx3xx4CRdqz/4A== X-Google-Smtp-Source: AGHT+IEsMkvGt7hLQi684Ay30ID1FMFVFevU1MTlJ0EnA8fvjeecyqBnmmmCk6jlChOFsa541LWk0g== X-Received: by 2002:a2e:859:0:b0:2f3:abca:8b0f with SMTP id 38308e7fff4ca-2f787ee1f49mr29803711fa.27.1726240169009; Fri, 13 Sep 2024 08:09:29 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:28 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:09 +0300 Subject: [PATCH v4 26/27] arm64: dts: qcom: starqltechn: add graphics support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-26-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=2196; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=FD1rljMeLn+151Vf5vciVGrZi3usPsZLEWnoi/tRPhI=; b=6C6CK/OA4qFYIxjuSjl3Jh3cGdMnGDl0PerNpUvETcvNDy9pXgL6GQGnrjeslJjmw0qV9V0Pz Phboy8dYDhEAvBqR7ufbk5QySAlCyzNfS4+gxeOVOYJOt+qRz7QJwzA X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for gpu and panel. Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index c36ad043edf0..2710386a89e1 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -203,6 +203,52 @@ vib_pwm: pwm { }; }; +&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 { @@ -837,6 +883,27 @@ &tlmm { gpio-reserved-ranges = <27 4>, /* SPI (eSE - embedded Secure Element) */ <85 4>; /* SPI (fingerprint reader) */ + 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; From patchwork Fri Sep 13 15:08:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dzmitry Sankouski X-Patchwork-Id: 828239 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 896E01C3F30; Fri, 13 Sep 2024 15:09:33 +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=1726240175; cv=none; b=qnNEYSB1a5xLPs0sDfIpXR986lhd2I9snSKjKQdM2G/LRoy36wdmESYAAUocnMavoOvgBECrVBAGoBRhGnHzRM0wG5rGmQIIoWnmRodabhjAWCbGUvY/d7uuSd3+FdfviqYLnbQYIdDxuVhQFqmp+X/4xhvy9Puh5Pz0bDnJKtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726240175; c=relaxed/simple; bh=sotlZbQi5UxMTXTY9iQWeBGitc5Ct0BtuZ2yW6i8Nok=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VNp+hW1d1PgsGFhK5D7e2RqyNGNAhD6Cmr5ocg6ziPLmseic6XHGkjcaTIe20Ec6kj4002Q46NVVExSRfVNqqn6Jn738mX6ABG1vUp2V4LBk1bPSaoMxGgYR5hsly/UxEWlq2t1Dg4VRnJlKXUIzFvnFI30yLftOzpCSj3E/pSY= 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=QqtG5sjD; 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="QqtG5sjD" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c26311c6f0so2944448a12.3; Fri, 13 Sep 2024 08:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726240171; x=1726844971; 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=mXJIkSLw8SmFch9ZUCSaWYebLdfaycyre/4lwJqktRc=; b=QqtG5sjD75MPPTL9uxDFdApVZ3+r7KD2KL0iNEd7Js90da5B8v2G7y+/hyWDKlV5rX 3Fztu+Wr2ICdSY2o/ip5d3KH8+xusrmEk4hGscNhCdvFluwf/bmjeOVoL8nh2Ixdb9IJ 8U3CtH+hvCV76li6tt5eG48Gg8AHVZvQlRHh8Iy1dsORWODQX5jFUWiWqOMInp9PIMAH Eam4aRySDKUWLk1mcEu1RA6JcvJ5gyFy+57gK4h1j2AScZLQbGYtM+Xs1NvdELKUDhmk VuhKzTAeL7kuvMrIK55UaKutlSNNDmXIDkoTqOUNNL/vrl+yneS+sZaOlU7w6poRuwn5 7baw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726240171; x=1726844971; 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=mXJIkSLw8SmFch9ZUCSaWYebLdfaycyre/4lwJqktRc=; b=J9s27h1UUGLr84U5/yAyZJsgI6gwTHTQQ+vx/u51IwWj7gqz1CmyTrroV5jq8Uh2kr E6u/R847+cr5r/nQ2cV7iHoiZ/O8Tnuqm1jUfKDhRIJ/WZF6sKhlzSzO04n2OS86LbR0 EUfQ2zyMBYDHXc6Q4qcMzz39U9NEvPDWHumLR14W95EsHaqGt0qOc1T96vkXLvxGZDoi R5rnELotNTtDWaSnFytAWVM0bOaJ7FdMiB9fpweo4LiQ3ATYKmZdbNBA+ImhCfSjQ0Ch 6NmICZQIdot3wAagTOVaiWzPG5FK7xN17aQ/feXCCjFm8oGKxBLN0/GNL+ae640xuK/z 0wHQ== X-Forwarded-Encrypted: i=1; AJvYcCUhCX0BAMk05IyBLSQutDLJfVWTFswx9F6GWd198LSABd381GBIIaofuv+n3Fa5lFEPdxdJepGB/ueakzc=@vger.kernel.org, AJvYcCUuti24ziJKj2yZFdgTlk5qdVp945GGwnleaoFOwvGYAgF7kM/9o3AZlWOLxs+cYjH4P6bgysgzQEM9drJk@vger.kernel.org, AJvYcCV/qB5ttufj9m/e1++oHyIrcBu/Jt7mXBsrsWZpW93JbSKj/Zx9IYSZWtbqcNxF6T8URIhVfGCxA7YUd61q3DF5fE0=@vger.kernel.org, AJvYcCVkbNcUFQEropyKy8NfbbsMNZ0QFvOOxr1HnVH6jZrBzr082ilPdQ9RkssS8xkcR+35Qbb7GX9WOIsQu46sKg==@vger.kernel.org, AJvYcCWkJ1fxPDQw+F8r8yx7Po3+bsO/Ie2HEvDLachSkDhlUvGLdF0gIqwUzuNz3Ji0C3TXXVK+1MAIYtX+@vger.kernel.org, AJvYcCXJHZsaa+Lap0z/vITRjAjE62GtCcTohp03NyLwF6TsIf9FuM6fHeZe2uwiRnsoxTVQn7RploJGBy5rBw==@vger.kernel.org, AJvYcCXJnUnKOXJwgWI/0HxHCnRFJ6i5GZUP9VgPjkF/qb/TieQqREoyTLOspdurnGLOHPfqyNQSodpmpsci@vger.kernel.org, AJvYcCXt0cotO6XZozI3melRYob9QNcTS0GS2D4FCOYxAwa1B0Sgm/cZTNkjEey2pOgXjSPttPPrsaluxiW0@vger.kernel.org X-Gm-Message-State: AOJu0YxuhtrqkE/IfZ68GjJMK0tVXPbHrxcDBj+ASAUTOSw7C4Nva94o ajFXxhiT6NXbFfN+Y1dTeTE+SQ9dGLGsQrG0J2viUkESwvG/xvQyBeZVeA== X-Google-Smtp-Source: AGHT+IGyk1J+WrXxg3n6en6ZybXZ+SEJzAfSUZQA055wEMUefoWDRM5H6YgIPbZdZbXXjvmPnSljDQ== X-Received: by 2002:a05:6402:35c1:b0:5c4:181a:6b0a with SMTP id 4fb4d7f45d1cf-5c4181a6b7dmr4656181a12.10.1726240171482; Fri, 13 Sep 2024 08:09:31 -0700 (PDT) Received: from [127.0.1.1] ([178.127.153.210]) by smtp.googlemail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd523b4sm7774318a12.51.2024.09.13.08.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Sep 2024 08:09:31 -0700 (PDT) From: Dzmitry Sankouski Date: Fri, 13 Sep 2024 18:08:10 +0300 Subject: [PATCH v4 27/27] arm64: dts: qcom: starqltechn: add modem support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240913-starqltechn_integration_upstream-v4-27-2d2efd5c5877@gmail.com> References: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@gmail.com> In-Reply-To: <20240913-starqltechn_integration_upstream-v4-0-2d2efd5c5877@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 , 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 , Chanwoo Choi , Simona Vetter , cros-qcom-dts-watchers@chromium.org, Konrad Dybcio , Simona Vetter , Konrad Dybcio 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=1726240085; l=2030; i=dsankouski@gmail.com; s=20240618; h=from:subject:message-id; bh=sotlZbQi5UxMTXTY9iQWeBGitc5Ct0BtuZ2yW6i8Nok=; b=2OY/1Wou8Los9DL2QaeQkDbKQavhO22dQvFX7va+9W+VFm6Zwxp1qTyqVIttAEcQn/XWN02FC mMW9IBedqIOB+8AWBDGbU1ksLCmuAtMW2nQ+hhGKetema4Hwj+gR7YU X-Developer-Key: i=dsankouski@gmail.com; a=ed25519; pk=6pMMVVDDReSiRgPCbMOUauN5nS3ty4Sf5b7a2gi4x0M= Add support for modem and ipa(IP Accelerator). Add spss reserved memory node. Signed-off-by: Dzmitry Sankouski --- .../boot/dts/qcom/sdm845-samsung-starqltechn.dts | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts index 2710386a89e1..4614ec5f731f 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts @@ -17,6 +17,8 @@ #include "pm8998.dtsi" #include "sdm845-wcd9340.dtsi" +/delete-node/ &rmtfs_mem; +/delete-node/ &spss_mem; /delete-node/ &adsp_mem; /delete-node/ &slpi_mem; @@ -91,15 +93,39 @@ memory@a1300000 { pmsg-size = <0x40000>; }; + /* + * 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 { + reg = <0 0x88f00000 0 0x1c00000>; + no-map; + }; + 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; }; + + rmtfs_mem: rmtfs-mem@fde00000 { + compatible = "qcom,rmtfs-mem"; + reg = <0 0xfde00000 0 0x202000>; + qcom,use-guard-pages; + no-map; + + qcom,client-id = <1>; + qcom,vmid = ; + }; }; gpio_keys { @@ -837,6 +863,19 @@ dai@5 { }; }; +&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"; };