From patchwork Fri Jul 26 19:49:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13743126 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 CFD693BBC1; Fri, 26 Jul 2024 19:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023540; cv=none; b=AFopdWFF5BAvfwknE453qipqaMLiB3tIVfzWJ2dGJ33m8hBzJldY+dWh9tEB5573wMojEsyjckYgp6MujDpN4SrY4fl9tn9JJRsxlTq5p34VNDcu2Y7QCAEKI85V8vevgU4TwyfIM5nJQoy7sKetX4JN2JGOfxL+cpOLMM0UC4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023540; c=relaxed/simple; bh=5562yB6GG582jQ2FjweWBJG9xmyG/AzopD+FehW3LLA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ck3kXwN4OHVEDmH+IuayMBCkvdszFfmrAhh3FkohCWcISjxdbHUZsURx0l8vTKtgg3esDyiYKlAwnuF6SxkscaQpSiLVomIRJ2g1baT9Iy1nbXn+s9eJGVTDMoW8k3Iw5lOH6rNCsg08v4SwkAmrtCGkR+gzn9+mpMsnF/abWCo= 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=h0IPe2r5; arc=none smtp.client-ip=209.85.210.45 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="h0IPe2r5" Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-709340bd54dso675310a34.1; Fri, 26 Jul 2024 12:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722023538; x=1722628338; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4+k3gjF8BoooWUfXQn49JWorftRpntAb8sxIAYpbdwo=; b=h0IPe2r5YA74DcOnYwXCzAFXj46uJsGSvmpfXnH0VNtnGTQGREGXAScPSUWoi7jF3s +mZhdoigLhR2pzlRqgpuNzqO1bVZ4XC3DymeQIbcaaifOxI0cJ7seBnVkPJJfpj0MkqJ LoQOGHdbgoGZuGnWiLlWEK75wwpA54Ervk8zrEXiG4L9sUCiP/5my/BxPYwQknwxr/yD T3DFTr16gp3+WKgXKpGVt9695m09qScBCUj3+bjeP6YYxyDJl50HX2dKScamUild02z6 9KuVdVBDmmZJoyx2UEYcBTV3VcX70zDBffEim86MluyPPsPazZwpkcSY5DfMuTn+Jg10 AUsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722023538; x=1722628338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4+k3gjF8BoooWUfXQn49JWorftRpntAb8sxIAYpbdwo=; b=V1QY9TFRia16MBm9WPscofXU0yO7aEJ/J3utsic36yA1pExUzp+eJne0r0vVygsd7v JhkSlv50Ys2tFnNDcZjYYhMikmGfAZYgxC/nHRHjTZjUDIl+OZkR+yhSGUUdG3RrJuSC OXDjUWBwbMXtCtNvQzRlJoOuyKAeXJdK2Ajb41g7lbwrap5Kbf9+3Pq5/CFRQO9x4EB8 x67p0AO9yOpELB9Ey4PVSCrRORpBp8ZrmGCOQUk4xN/ThxmcIobJzx4kLvWel1RHRwdD eFms3Dit4xVdlz9Kq1Gs45TBAxDOTueEiTwPPq1xtRnVijBwc4+HqxRIUk8TuRGx736A IHYw== X-Forwarded-Encrypted: i=1; AJvYcCWN/PmQW4XKuSYRrtVT/QnKPslKZREsuPHko4IacvR6d2cGyEiGWI8hWiazX8QRrEOFW8334HPGYK7E9fpkCujg3kqdMb5kZodFXA== X-Gm-Message-State: AOJu0YzyoXUjpp/I1ApmJFTWQ2pSZyvdve4J4JPF6fP7KNwnN7X2exw3 fJbNrdLhu3clYgTYEIj+WGmR3SDdLLos+7KvSRUHaPjGC5EsvABK X-Google-Smtp-Source: AGHT+IHuz8TrULo3PxDivHC7WO52EaKTYugZpCRax3nUL6uYgAUk3XLu9b73tQtTCA8ceOKeHGVvbQ== X-Received: by 2002:a05:6830:350b:b0:709:41c4:6a5 with SMTP id 46e09a7af769-70941c40c40mr158952a34.3.1722023537867; Fri, 26 Jul 2024 12:52:17 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf:c1f3:7caa:bc8b:ab10]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70930778069sm889972a34.59.2024.07.26.12.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 12:52:17 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, jagan@edgeble.ai, andyshrk@163.com, jonas@kwiboo.se, sre@kernel.org, t.schramm@manjaro.org, heiko@sntech.de, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, Chris Morgan Subject: [PATCH 1/5] dt-bindings: power: supply: add dual-cell for cw2015 Date: Fri, 26 Jul 2024 14:49:44 -0500 Message-Id: <20240726194948.109326-2-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240726194948.109326-1-macroalpha82@gmail.com> References: <20240726194948.109326-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan According to the datasheet for the cw2015 the device supports dual-cell configurations. Add a new device tree property for this condition so that the voltage values reported to userspace are correct. Signed-off-by: Chris Morgan Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/power/supply/cw2015_battery.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml b/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml index dc697b6147b2..0e7866d42cca 100644 --- a/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +++ b/Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml @@ -34,6 +34,12 @@ properties: minItems: 64 maxItems: 64 + cellwise,dual-cell: + description: | + This property specifies if the battery is used in a dual-cell series + configuration so that the correct voltage is presented to userspace. + type: boolean + cellwise,monitor-interval-ms: description: Specifies the interval in milliseconds gauge values are polled at From patchwork Fri Jul 26 19:49:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13743127 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.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 6930F44C61; Fri, 26 Jul 2024 19:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023540; cv=none; b=n49uJ1EoaA5z/sfVtNSCx3BkQa2heC+iNEK15wbQ0OyPKHJZ/TqoUsUYNVkyGTx63nbQrf7CwZtPqGiRjlwNPhjS9JlXqkDAQihXIWz1jOPZVsDBNQY75UUwuamLrqi0nffbuDYhnpdt4E2tF26z/BNuESnyIFOUiwVtP4NqdgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023540; c=relaxed/simple; bh=Wg5fWNhfV3VcE5zdPsBscKsWfwaOt8kpZhzfjWLAknI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=edHk2WCU5JqRhn8spt360PjKdDsX0cm+sF5jg1hiGBk9sev5JDafbYRQFYqsY9f9oZtEWZCcy8FUPDWRjF+TVYencTePVTD3KFmppXDDijPykf6ulWzKpw6eD+lBJnys7VYWitSsHlKT3IP78gl87rpgU3kkhY1ROlgAqSU0Ex0= 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=ZIPCIqdY; arc=none smtp.client-ip=209.85.210.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="ZIPCIqdY" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-70361745053so616508a34.0; Fri, 26 Jul 2024 12:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722023538; x=1722628338; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U65j//PVGPMnXq7lvPNajRb5WEczobVRzKngFXWVkqo=; b=ZIPCIqdYfGT8Bww2t1Ylww04HY3yZ888x7VTLW05BSZ7gD/MlXPSbAfDI3ANg/uMIQ hf0b/0U2XIQM4aZDko5CUoAcMokwqq03vPnjidnVFk2Xe6oFaLqigv2Nou8XYURi1/V4 gXRDlqtJ1z/y5pPNHrttWQixVMIDMzSQpmtvIdv5HijT6jIBQuQmAiN4vuiCkhnTNppv THT4AkhGbqD0Y/6vsXYd/pzJ5UxCFM1iJcHjIcoR2bk48qdROBQ7sGAdUSvd1p21sZoo 5GDc08iOqYgmN/3wr1iF8iFkcVy1OF9gqATQ4ns1HSM5taNcQJyTtLm7TBY8HyolrnmW wxeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722023538; x=1722628338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U65j//PVGPMnXq7lvPNajRb5WEczobVRzKngFXWVkqo=; b=Etj7sWcN/hLMz3pCOF13r5I9I87hbh1wCi1V+ebuOiyLfWIhBfdDjaTbA9OLp7CcXT DF46f2TXcQaPSIRPNcHX6+0pZW1eqWxs5F3MjVo23CC4bd5ErpZtgvPrU0J9ijbVGx+z N4895TpFf2BKTuuUxTLPOIRxxsoVrbo0P6Hcb+nDuywAkSTKjSFAry1RFqCM9lQdzKPY Et9qeyd0gLkwK1B4X8UWx0+6Cn+gFZrefDRWscEdnBz+2p1KQCsuBUCs8OXNd7ts5CM+ qg3cese8q9zMCbBtHdL1WiHI3aP5AedFI9LzZZ4q5TYq8oCs7X4Gh67FKDF5e4YDp6hH cu0g== X-Forwarded-Encrypted: i=1; AJvYcCXBt6YUl8Heu0H1NnRgEJttnK2BnmxjHejDB5ManKVlubZ8CCBUIz1wBNIOp6KJa4vQ8EM8keeVrV2nZoKXet6P6QYLXAt1aOLEdA== X-Gm-Message-State: AOJu0YyKQ83AxWykbyxXOFB1c33L8s32fo6Pqd7RKXwVlQPALALYzya/ wgIdrPhgWWqF+d3olkRQAbIF0ncT5BJEvvv5pofL00dziKJ+PEdl X-Google-Smtp-Source: AGHT+IGqDKOZrQG0lnORBUuq0nhr1WbgwJ0MZK5eJDcDyNunTGSy0TUpdkpY3iH5A8Zl9p/Gr/nj+A== X-Received: by 2002:a05:6830:6817:b0:703:6cde:1cb9 with SMTP id 46e09a7af769-70940c93075mr242842a34.13.1722023538443; Fri, 26 Jul 2024 12:52:18 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf:c1f3:7caa:bc8b:ab10]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70930778069sm889972a34.59.2024.07.26.12.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 12:52:18 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, jagan@edgeble.ai, andyshrk@163.com, jonas@kwiboo.se, sre@kernel.org, t.schramm@manjaro.org, heiko@sntech.de, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, Chris Morgan Subject: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations Date: Fri, 26 Jul 2024 14:49:45 -0500 Message-Id: <20240726194948.109326-3-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240726194948.109326-1-macroalpha82@gmail.com> References: <20240726194948.109326-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace. Signed-off-by: Chris Morgan --- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c index f63c3c410451..b23a6d4fa4fa 100644 --- a/drivers/power/supply/cw2015_battery.c +++ b/drivers/power/supply/cw2015_battery.c @@ -77,6 +77,8 @@ struct cw_battery { u32 poll_interval_ms; u8 alert_level; + bool dual_cell; + unsigned int read_errors; unsigned int charge_stuck_cnt; }; @@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat) */ voltage_mv = avg * 312 / 1024; + if (cw_bat->dual_cell) + voltage_mv *= 2; + dev_dbg(cw_bat->dev, "Read voltage: %d mV, raw=0x%04x\n", voltage_mv, reg_val); return voltage_mv; @@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat) return ret; } + cw_bat->dual_cell = device_property_read_bool(dev, "cellwise,dual-cell"); + ret = device_property_read_u32(dev, "cellwise,monitor-interval-ms", &cw_bat->poll_interval_ms); if (ret) { From patchwork Fri Jul 26 19:49:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13743128 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.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 1853857CBE; Fri, 26 Jul 2024 19:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023541; cv=none; b=A0QZzhFN1TQivNfF2EPQNDM70Fg++iSIr8gj+yh46CcDMVcmjrsV+3hMHNc58Gcd4XtAy3NULbIFuwM3a+nkPxFBx7eZ2em1BgTmjBD/rR3hsFDtKDB4CgC9EgxdQv5NoPXfvRrUOsBHfIcm3aD9DzkAKNWPFUX8l6OA6kv7YWg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023541; c=relaxed/simple; bh=LFM9PFIR9IbGtOZpA6vNbeiXMowkml4+wA1Zh5gQWAM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fTHtQolvdFT8cUFYVn1A3/ofbi4Zu1jNSyA8Jg2cKWxE4XvwFTFgr+pycs3bA1E9Tsxx7fzn5unGAzP98fbPPVfXW8dYDyP8QZOBe/86yOKP6qwieYtXjD/6N6Dtbf32n6yKdWKFHZ3PdGDKs7V1ysRxlO4ysPf/U4ZILT4mKzI= 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=ZsmC0JAh; arc=none smtp.client-ip=209.85.210.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="ZsmC0JAh" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-708cf5138b6so1020355a34.0; Fri, 26 Jul 2024 12:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722023539; x=1722628339; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P6rmiAxGwGeB9IJv4k45WD7DbCveUNV1yEEf/83JRaI=; b=ZsmC0JAhPUnk9VOKXr3YD5KPvoZShsr4TC82BNZBK05xrO1EVAKWh9ARi3eByzotCd AY74Pa9knRIQz9psDNSZRSnsV8oxFNSS35Tdj+Aw2X/vDMAiHXhXfjodA86cU56kZaS6 FlqLpV9aQulOflYnKtm2ZTvCNEIbfy0/1AvctgTKxO52bd1EmCfbHAywWJjFvZ1hBK6i 4Dau9StrVvbTS8Jc2AA3vRurYOmWdsEPD77QS9qyFNlaaoOayAkzcegdKn+wHNMxWGA7 t1Ii4TwSPAPA/0VCMQag4sYBWqi/NwilduI5tQJu7Eh6KKv4wwqRKBANf6yYZXOAFeU7 p9Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722023539; x=1722628339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P6rmiAxGwGeB9IJv4k45WD7DbCveUNV1yEEf/83JRaI=; b=gD8disPj+hHPgj6cFP2FT/vyic+j2auJ1rNQWxYTR8dRKSEVJ6MHaEN2uxOkgG9bWk Tkf0RWjNNlmbiXY9nbP15wfRA7JxjJWtMjNyqzud+yL03fZcneSl5iOmZMkefR1A8zR8 Pk/H09cS/YczZO5YzLfd6rkXCpZJvCUjAB+ZYGOMtCTa0zRqYuk5bzEE/ihKeoehUF2m cT89C8dlljfSX+2dgBElT+DGDNE3wCNEBk7PNLR2cdHd44WyoeUNGlssYM8seu4JuZXv I/jLm4UCO+PNfPPton72oEr2xVRY2/auNqlcOBAAbi44d/3RV8WW+mX++K+HfQFXh9Ah oMgg== X-Forwarded-Encrypted: i=1; AJvYcCWjyX77byetg5edMUTunRt8qf55k4Po4BaTNBxhsEQKQLSQxfgPsD50yEvs9SnpjYbngNSWhVJ2sGSrOZBsgKcv0XS2UW6aTcZj9g== X-Gm-Message-State: AOJu0Yz3BMPIE94AGU34xx5hl3KuOjPpWwMmj3KaUupJg9GY4SH+MOgB EPUxkeJIONWQEEAEu8rYoiZKrpm7/hEwWFDxo4U3TrhX/PIiV0g5 X-Google-Smtp-Source: AGHT+IF0f29yKR6vZmoW9R2ZZFUMQXzYcT8J4lUuOIvw9i6Fucmn9tM77BX2/R1rNf1Ei5yrVKN1pw== X-Received: by 2002:a05:6830:2aa5:b0:703:6cdf:461b with SMTP id 46e09a7af769-70940c05695mr890633a34.6.1722023539199; Fri, 26 Jul 2024 12:52:19 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf:c1f3:7caa:bc8b:ab10]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70930778069sm889972a34.59.2024.07.26.12.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 12:52:18 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, jagan@edgeble.ai, andyshrk@163.com, jonas@kwiboo.se, sre@kernel.org, t.schramm@manjaro.org, heiko@sntech.de, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, Chris Morgan Subject: [PATCH 3/5] arm64: dts: rockchip: Pull up sdio pins on RK3588 Date: Fri, 26 Jul 2024 14:49:46 -0500 Message-Id: <20240726194948.109326-4-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240726194948.109326-1-macroalpha82@gmail.com> References: <20240726194948.109326-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan When using an Ampak derived bcm43456 on an RK3588s based GameForce Ace the WiFi failed to work properly until I set the SDIO pins from pull-none to pull-up. This matches the vendor kernel located at [1]. I tested this then on an RK3588s based Indiedroid Nova and did not observe any adverse effects. [1] https://github.com/rockchip-linux/kernel/commit/b96485b7af46a99c14f3c4818eb18c7836eb809c Signed-off-by: Chris Morgan Signed-off-by: Chris Morgan --- arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi index 30db12c4fc82..d1368418502a 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi @@ -2449,15 +2449,15 @@ sdiom1_pins: sdiom1-pins { /* sdio_clk_m1 */ <3 RK_PA5 2 &pcfg_pull_none>, /* sdio_cmd_m1 */ - <3 RK_PA4 2 &pcfg_pull_none>, + <3 RK_PA4 2 &pcfg_pull_up>, /* sdio_d0_m1 */ - <3 RK_PA0 2 &pcfg_pull_none>, + <3 RK_PA0 2 &pcfg_pull_up>, /* sdio_d1_m1 */ - <3 RK_PA1 2 &pcfg_pull_none>, + <3 RK_PA1 2 &pcfg_pull_up>, /* sdio_d2_m1 */ - <3 RK_PA2 2 &pcfg_pull_none>, + <3 RK_PA2 2 &pcfg_pull_up>, /* sdio_d3_m1 */ - <3 RK_PA3 2 &pcfg_pull_none>; + <3 RK_PA3 2 &pcfg_pull_up>; }; }; From patchwork Fri Jul 26 19:49:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13743129 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.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 BC2833BBC1; Fri, 26 Jul 2024 19:52:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023542; cv=none; b=s/0WlYMt7z0oC+pLbQ2NOeS2uC19D5Z3D8mo3MRSa1ES1fmKDT4RPdho8AMQ9a3W9FEi1MJGcwQMmxR4pDuh5oXUimRcTtjQDnszhA8zjwMQK9NxKdQVp+d/52RUj+EwxrVWNe8bipr9IvPG+ENotCuFJ+Dl9tF+JihQMA7Pz9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023542; c=relaxed/simple; bh=gIetfDeVvAKFROU3FU4BaYItI5DB23RvX5/OVYo/aqQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lY+WXNt8UMhT/KU81eb8xXmzGrotUU2/uXYUHMXXFi9sgwdWWfSRThDoY3qfUBqbjNR/JfTyyQGH1CkFBKjd4+IOJnWokm8mAN43oadEOzhNqf/3QBvaj9/NOLqEjSgxLTattj0QfThcNV6OCJ1ihEBz5AB40jE9BkJd9Gv4QOw= 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=G7XcyCSf; arc=none smtp.client-ip=209.85.210.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="G7XcyCSf" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-7093f3a1af9so358377a34.1; Fri, 26 Jul 2024 12:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722023540; x=1722628340; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h1/2W8RcQjiqKYDLwnvQA5GcanCOKJKq8/U5bOmJErk=; b=G7XcyCSf1JXLLVKMnUAx80Kl6wsjATra2OJU9iLl6vRWTRcpJLZBEYyK/uk/IwMMia 7tCRPveGWaEPCXa4HYuNaDmbZSs/cxdpc6QpqoQQbQHQ879HcqJ9+kT2/inJcQxoupeb cj9rl/Ag56RgxPaIPhuLRHH7orcUVpBKQOsN78rlkt7CVbNULPBMMAVEuhWEsTbbl4r4 /zki9N7YsR3aoQbcGIqgZRoMBj+3XDJNOSFS/QqbFiSF6mbnPZulGdZORyJHlGu6cVH7 x3LeeHYadezwSc2Zv/s2/l4rZ1yh3F+wf5AKWe+Y3zADl75juQEHS6a7Rol2DLb1nUhf dr4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722023540; x=1722628340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h1/2W8RcQjiqKYDLwnvQA5GcanCOKJKq8/U5bOmJErk=; b=PPBoWpIz4Y811V/3z/4N8FnmqrxM+I3zU/GRMr8gmpy0rKLAOPRyEU0eGz/JUomsod nAS+jCrVpbppHkwwX1smB/Ls8cihrjKn2XYCofYQaSaZfJf/hVGOL9qwCyLVq0r15P8p 8qSuR2Wn7y+XB8uiDkVx9Ww30M8d9hLx6cOEoItJfV4bpmgTIdVo1ofAqAVf9tnncREI HFpSLI5CUQndS5bo/iCOny8ovmyxPw3pxVkjh6mMNRWegGDu1pD+LFBYpP8O505dmHlm 6fnzLWMs5nJEPdXARHJQHUTpzIZyidfc0uhUptGRUP/U8Jn97Dk6vkiqoE6abIWBX24j MlLQ== X-Forwarded-Encrypted: i=1; AJvYcCU66kdBhTtLmSQZHVTzN9UhOQ4k98JBjcn2rk9sKQ+QtzU3Cav3pIoEyJ1RCY3jyfEJqRtoJN/1ao6H1HpxtseV/8Z2jL1Gp6Ixtw== X-Gm-Message-State: AOJu0YxDJiP4KaxejcbPb7ZIbHIktAgw/HdVihGRO72ffL77VWB1Y9rM xbxAQgy0ghlxAMgCcFeSPHC0xzBNUA3Sw70Urb1VudTEbHg5M0AF X-Google-Smtp-Source: AGHT+IGFD8UcnUWfAtOrktYS3XPLNwRusDiWDkC1Xvsjj1zIrmYzOL1G4rpSrpvg425XDPJUWhxSfQ== X-Received: by 2002:a05:6830:6e04:b0:707:e28:58d2 with SMTP id 46e09a7af769-70940c0b3d6mr919254a34.2.1722023539885; Fri, 26 Jul 2024 12:52:19 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf:c1f3:7caa:bc8b:ab10]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70930778069sm889972a34.59.2024.07.26.12.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 12:52:19 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, jagan@edgeble.ai, andyshrk@163.com, jonas@kwiboo.se, sre@kernel.org, t.schramm@manjaro.org, heiko@sntech.de, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, Chris Morgan Subject: [PATCH 4/5] dt-bindings: arm: rockchip: Add GameForce Ace Date: Fri, 26 Jul 2024 14:49:47 -0500 Message-Id: <20240726194948.109326-5-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240726194948.109326-1-macroalpha82@gmail.com> References: <20240726194948.109326-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan Add devicetree binding for the GameForce Ace. Signed-off-by: Chris Morgan Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/rockchip.yaml b/Documentation/devicetree/bindings/arm/rockchip.yaml index 1ef09fbfdfaf..a5a2621404ae 100644 --- a/Documentation/devicetree/bindings/arm/rockchip.yaml +++ b/Documentation/devicetree/bindings/arm/rockchip.yaml @@ -255,6 +255,11 @@ properties: - const: friendlyarm,cm3588 - const: rockchip,rk3588 + - description: GameForce Ace + items: + - const: gameforce,ace + - const: rockchip,rk3588s + - description: GameForce Chi items: - const: gameforce,chi From patchwork Fri Jul 26 19:49:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13743130 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.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 AAB1D13C9C8; Fri, 26 Jul 2024 19:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023544; cv=none; b=Mw+pJDsn/q7BWyRtfZYf002pIq6TLgcWlTDsEnAfoNs/osNuTXahAaz9Ogik1JHosIZLTZ6xCl4udsEddkIs2+nyXjuLYhpZ1nxQ+vJ91JTUxhLdk7sEG+HxNYJ+QoYYoPrQzDWS7L5KcEPUAaqw8I6D/qA0xr0/7ufQr2EFJqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722023544; c=relaxed/simple; bh=5ER54b6wYCYw6L+RnyYjNcgbXZTpS+2zIcg4kliRw48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kEjLpvXAUyMyJrctQJRV/+Civw7fr5De73ZJ+4BqAzqeb7+9AcuM2LnKyCV2qPlZIpSeWVwai6HajZOLfqDnaue7YDT2y8DYA60EZ0IeZQPAqUWUG2URI25d6lEFimtGJUiCMPwtPyaEtITnsB9UhCZrYrOAR5S+wXqJja4FbjA= 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=H4frex0P; arc=none smtp.client-ip=209.85.210.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="H4frex0P" Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-70936061d0dso946890a34.2; Fri, 26 Jul 2024 12:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722023541; x=1722628341; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6665zskBk89UQSK8m0c+HAHxuj+ylGU88m1ovqJeb4Q=; b=H4frex0P+y1e+AibjsAiYPvR1jlKADHYBkYMN2gNwH4FPQo3ZzsNUEECM33wI2Uyqy Zkp0e6T7a+C2joa8RguJPNSjuvfA+rZB8rwcpaQb1PT57vuivl7vBqL8I1mh64MSEgT1 nuRPbXXtO/67wdCutWB4AYyNJnn1lYlU+GqRyjDtexHkppDB1D5R5Xajo6xPMtIBugpK sXldjdzTXyvLSH72C2Hvp3Wxlwv5GgFaIgDVaf2UfTYy7PPPDYWgF4tM/LOOw3VggwNx uo16DNaYxGt8FuZAXxlGW90luIcjox81wpd7+dT5u3Oyn5pvytABG3kqpCdNfvtE75f6 87UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722023541; x=1722628341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6665zskBk89UQSK8m0c+HAHxuj+ylGU88m1ovqJeb4Q=; b=hPEdWXDZ8ykrUFr7bx406z3ooD0krjQ696AdiBPh4Ts50dfzExTR0lgGi0f4mcjG5q W8KMq5vmZMBIzLFd5FU53ChASSDamuIQlwr6+3bXyM939qKkOj4nHs2Ly0rMGVGp76eD 7nYqL0cr5hAr1X03ZqNlFZIZcMDYqR+gxQFx85THZudMb4GG+sA/h2gWu3q9DT25Eg+0 3qzNOqnCezaXsfFFIb4toNRttKbjCsIfrsOQoShDl1FKXVVBF7tviOgeNw9d9CMv4VHZ 2le6A890+YmvRsH9+JaCH3PMxqcl2fudtlB8zCDC8NXF+DBbJaKvTtZjmdpW93FT+ZeS 7uOw== X-Forwarded-Encrypted: i=1; AJvYcCWT7p+TP/FGwmfXnvU2zxhyQtoqDqIXd2FA0rMbfdyRO3kIV8Qylxf28JqX3x4y7NFywn6jL5tSUXIjw/s9jy4OfVh8qmn5fCC/4Q== X-Gm-Message-State: AOJu0YxeI4sGAa1M3aos2TXwK5lw/lYJ2lpmKnjsy3msWclPByA6KdeW RbLUFA46h/8HbDs6rHpVH0CKVcfqaiacLuDNSFgZuGW8J9R0ekn4 X-Google-Smtp-Source: AGHT+IEX2G0wNWSXrc8ZM91SZDSinvSHsFhYu8A+3C+RLjDcAMW/Mr2A2a+C4Z52I9yCXsCEHVueTQ== X-Received: by 2002:a05:6830:6009:b0:709:410c:2c96 with SMTP id 46e09a7af769-709410c2ec1mr735378a34.10.1722023540573; Fri, 26 Jul 2024 12:52:20 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:fb0:1bcf:c1f3:7caa:bc8b:ab10]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-70930778069sm889972a34.59.2024.07.26.12.52.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 12:52:20 -0700 (PDT) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, jagan@edgeble.ai, andyshrk@163.com, jonas@kwiboo.se, sre@kernel.org, t.schramm@manjaro.org, heiko@sntech.de, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, Chris Morgan Subject: [PATCH 5/5] arm64: dts: rockchip: Add GameForce Ace Date: Fri, 26 Jul 2024 14:49:48 -0500 Message-Id: <20240726194948.109326-6-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240726194948.109326-1-macroalpha82@gmail.com> References: <20240726194948.109326-1-macroalpha82@gmail.com> Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Chris Morgan The GameForce Ace is a portable gaming device based on the Rockchip RK3588s SoC. The device contains the following hardware that is tested/working: - 128GB eMMC - SDMMC card slot - Ampak SDIO WiFi 5/BT - NVME 2242 socket - 8 or 12GB of RAM - Goodix based touchscreen - Stereo speakers, internal microphone, and TRRS headphone jack. - Dual GPIO vibrators (implemented as gpio-pwm because they are quite strong) - Multiple face buttons, dual analog joysticks, and dual analog triggers - PWM fan with tach pin. The device also contains the following hardware that is partially or currently not working: - 1920x1080 DSI display - HDMI port - USB-C port with DP alt-mode - TI bq25703 charger controller Signed-off-by: Chris Morgan --- arch/arm64/boot/dts/rockchip/Makefile | 1 + .../dts/rockchip/rk3588s-gameforce-ace.dts | 1315 +++++++++++++++++ 2 files changed, 1316 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile index fda1b980eb4b..62c3e53d24b4 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -139,6 +139,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-tiger-haikou.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-toybrick-x0.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-turing-rk1.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-coolpi-4b.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-gameforce-ace.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-nanopi-r6s.dtb diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts b/arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts new file mode 100644 index 000000000000..01483444cee6 --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts @@ -0,0 +1,1315 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include +#include +#include +#include +#include +#include "rk3588s.dtsi" + +/ { + model = "Gameforce Ace"; + chassis-type = "handset"; + compatible = "gameforce,ace", "rockchip,rk3588s"; + + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc; + mmc2 = &sdio; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + adc_keys: adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1800000>; + poll-interval = <60>; + + button-vol-up { + label = "VOLUMEUP"; + linux,code = ; + press-threshold-microvolt = <17000>; + }; + + button-vol-down { + label = "VOLUMEDOWN"; + linux,code = ; + press-threshold-microvolt = <417000>; + }; + }; + + /* Joystick range values based on hardware observation. */ + adc_joystick: adc-joystick { + compatible = "adc-joystick"; + #address-cells = <1>; + io-channels = <&saradc 2>, <&saradc 3>, + <&saradc 4>, <&saradc 5>; + poll-interval = <60>; + #size-cells = <0>; + + axis@0 { + reg = <0>; + abs-flat = <40>; + abs-fuzz = <30>; + abs-range = <0 4095>; + linux,code = ; + }; + + axis@1 { + reg = <1>; + abs-flat = <40>; + abs-fuzz = <30>; + abs-range = <0 4095>; + linux,code = ; + }; + + axis@2 { + reg = <2>; + abs-flat = <40>; + abs-fuzz = <30>; + abs-range = <0 4095>; + linux,code = ; + }; + + axis@3 { + reg = <3>; + abs-flat = <40>; + abs-fuzz = <30>; + abs-range = <0 4095>; + linux,code = ; + }; + }; + + /* Trigger range values based on hardware observation. */ + adc_triggers: adc-trigger { + compatible = "adc-joystick"; + #address-cells = <1>; + io-channels = <&ti_adc 6>, + <&ti_adc 7>; + poll-interval = <60>; + #size-cells = <0>; + + axis@0 { + reg = <0>; + abs-flat = <15>; + abs-fuzz = <15>; + abs-range = <890 1530>; + linux,code = ; + }; + + axis@1 { + reg = <1>; + abs-flat = <15>; + abs-fuzz = <15>; + abs-range = <1010 1550>; + linux,code = ; + }; + }; + + amp_headphone: headphone-amplifier { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&headphone_amplifier_en>; + pinctrl-names = "default"; + sound-name-prefix = "Headphones Amplifier"; + }; + + amp_speaker: speaker-amplifier { + compatible = "simple-audio-amplifier"; + enable-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&speaker_amplifier_en>; + pinctrl-names = "default"; + sound-name-prefix = "Speaker Amplifier"; + VCC-supply = <&vcc5v0_spk>; + }; + + analog-sound { + compatible = "simple-audio-card"; + pinctrl-0 = <&hp_detect>; + pinctrl-names = "default"; + simple-audio-card,aux-devs = <&_headphone>, <&_speaker>; + simple-audio-card,bitclock-master = <&masterdai>; + simple-audio-card,format = "i2s"; + simple-audio-card,frame-master = <&masterdai>; + simple-audio-card,hp-det-gpio = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,name = "rockchip,es8388-codec"; + simple-audio-card,pin-switches = "Headphones", "Speaker"; + simple-audio-card,routing = + "Speaker Amplifier INL", "LOUT2", + "Speaker Amplifier INR", "ROUT2", + "Speaker", "Speaker Amplifier OUTL", + "Speaker", "Speaker Amplifier OUTR", + "Headphones Amplifier INL", "LOUT1", + "Headphones Amplifier INR", "ROUT1", + "Headphones", "Headphones Amplifier OUTL", + "Headphones", "Headphones Amplifier OUTR", + "LINPUT1", "Microphone Jack", + "RINPUT1", "Microphone Jack", + "LINPUT2", "Onboard Microphone", + "RINPUT2", "Onboard Microphone"; + simple-audio-card,widgets = + "Microphone", "Microphone Jack", + "Microphone", "Onboard Microphone", + "Headphone", "Headphones", + "Speaker", "Speaker"; + + simple-audio-card,cpu { + sound-dai = <&i2s0_8ch>; + }; + + masterdai: simple-audio-card,codec { + sound-dai = <&es8388>; + system-clock-frequency = <12288000>; + }; + }; + + battery: battery { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3700000>; + constant-charge-current-max-microamp = <2500000>; + constant-charge-voltage-max-microvolt = <8750000>; + voltage-min-design-microvolt = <7400000>; + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + pinctrl-0 = <&btn_pins_ctrl>; + pinctrl-names = "default"; + + button-a { + gpios = <&gpio1 RK_PC6 GPIO_ACTIVE_LOW>; + label = "EAST"; + linux,code = ; + }; + + button-b { + gpios = <&gpio1 RK_PA5 GPIO_ACTIVE_LOW>; + label = "SOUTH"; + linux,code = ; + }; + + button-down { + gpios = <&gpio1 RK_PB1 GPIO_ACTIVE_LOW>; + label = "DPAD-DOWN"; + linux,code = ; + }; + + button-home { + gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_LOW>; + label = "FUNCTION"; + linux,code = ; + }; + + button-l1 { + gpios = <&gpio1 RK_PB5 GPIO_ACTIVE_LOW>; + label = "L1"; + linux,code = ; + }; + + button-left { + gpios = <&gpio1 RK_PD7 GPIO_ACTIVE_LOW>; + label = "DPAD-LEFT"; + linux,code = ; + }; + + button-menu { + gpios = <&gpio1 RK_PB0 GPIO_ACTIVE_LOW>; + label = "HOME"; + linux,code = ; + }; + + button-r1 { + gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>; + label = "R1"; + linux,code = ; + }; + + button-right { + gpios = <&gpio1 RK_PB7 GPIO_ACTIVE_LOW>; + label = "DPAD-RIGHT"; + linux,code = ; + }; + + button-select { + gpios = <&gpio1 RK_PA3 GPIO_ACTIVE_LOW>; + label = "SELECT"; + linux,code = ; + }; + + button-start { + gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_LOW>; + label = "START"; + linux,code = ; + }; + + button-thumbl { + gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_LOW>; + label = "THUMBL"; + linux,code = ; + }; + + button-thumbr { + gpios = <&gpio1 RK_PD6 GPIO_ACTIVE_LOW>; + label = "THUMBR"; + linux,code = ; + }; + + button-up { + gpios = <&gpio1 RK_PA2 GPIO_ACTIVE_LOW>; + label = "DPAD-UP"; + linux,code = ; + }; + + button-x { + gpios = <&gpio1 RK_PB4 GPIO_ACTIVE_LOW>; + label = "NORTH"; + linux,code = ; + }; + + button-y { + gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>; + label = "WEST"; + linux,code = ; + }; + }; + + gpio_leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + + green_led: led-0 { + color = ; + gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_STATUS; + }; + + red_led: led-1 { + color = ; + gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_HIGH>; + function = LED_FUNCTION_CHARGING; + }; + }; + + pwm_fan: pwm-fan { + compatible = "pwm-fan"; + #cooling-cells = <2>; + cooling-levels = <0 120 150 180 210 240 255>; + fan-supply = <&vcc5v0_sys>; + interrupt-parent = <&gpio4>; + interrupts = ; + pulses-per-revolution = <4>; + pwms = <&pwm12 0 50000 PWM_POLARITY_INVERTED>; + }; + + pwm_gpio33: pwm-33 { + compatible = "pwm-gpio"; + gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&vib_right_h>; + pinctrl-names = "default"; + #pwm-cells = <3>; + }; + + pwm_gpio132: pwm-132 { + compatible = "pwm-gpio"; + gpios = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&vib_left_h>; + pinctrl-names = "default"; + #pwm-cells = <3>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clock-names = "ext_clock"; + clocks = <&rtc_hym8563>; + pinctrl-0 = <&wifi_enable_h>; + pinctrl-names = "default"; + post-power-on-delay-ms = <200>; + power-off-delay-us = <5000000>; + reset-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>; + }; + + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { + compatible = "regulator-fixed"; + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1100000>; + regulator-min-microvolt = <1100000>; + regulator-name = "vcc_1v1_nldo_s3"; + vin-supply = <&vcc5v0_sys>; + }; + + vcc3v3_lcd0_n: vcc3v3-lcd0-n-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&vcc_lcd_h>; + pinctrl-names = "default"; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc3v3_lcd0_n"; + vin-supply = <&vcc_3v3_s3>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_sd_s0: vcc-3v3-sd-s0-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&sd_s0_pwr>; + pinctrl-names = "default"; + regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3000000>; + regulator-name = "vcc_3v3_sd_s0"; + vin-supply = <&vcc_3v3_s3>; + }; + + vcc5v0_spk: vcc5v0-spk-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio4 RK_PA2 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&vcc5v0_spk_pwr>; + pinctrl-names = "default"; + regulator-max-microvolt = <5000000>; + regulator-min-microvolt = <5000000>; + regulator-name = "vcc5v0_spk"; + vin-supply = <&vcc5v0_sys>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc5v0_sys: vcc5v0-sys-regulator { + compatible = "regulator-fixed"; + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <5000000>; + regulator-min-microvolt = <5000000>; + regulator-name = "vcc5v0_sys"; + }; + + vibrator_l: vibrator-l { + compatible = "pwm-vibrator"; + pwm-names = "enable"; + pwms = <&pwm_gpio132 0 20000000 0>; + }; + + vibrator_r: vibrator-r { + compatible = "pwm-vibrator"; + pwm-names = "enable"; + pwms = <&pwm_gpio33 0 20000000 0>; + }; +}; + +&combphy2_psu { + status = "okay"; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_lit_s0>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_big0_s0>; +}; + +&cpu_b2 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&cpu_b3 { + cpu-supply = <&vdd_cpu_big1_s0>; +}; + +&gpu { + mali-supply = <&vdd_gpu_s0>; + status = "okay"; +}; + +&i2c0 { + pinctrl-0 = <&i2c0m2_xfer>; + pinctrl-names = "default"; + status = "okay"; + + vdd_cpu_big0_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + regulator-max-microvolt = <1050000>; + regulator-min-microvolt = <550000>; + regulator-name = "vdd_cpu_big0_s0"; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_big1_s0: regulator@43 { + compatible = "rockchip,rk8603", "rockchip,rk8602"; + reg = <0x43>; + regulator-max-microvolt = <1050000>; + regulator-min-microvolt = <550000>; + regulator-name = "vdd_cpu_big1_s0"; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c2 { + status = "okay"; + + vdd_npu_s0: regulator@42 { + compatible = "rockchip,rk8602"; + reg = <0x42>; + regulator-max-microvolt = <950000>; + regulator-min-microvolt = <550000>; + regulator-name = "vdd_npu_s0"; + regulator-ramp-delay = <2300>; + fcs,suspend-voltage-selector = <1>; + vin-supply = <&vcc5v0_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c3 { + status = "okay"; + + touchscreen@14 { + compatible = "goodix,gt911"; + reg = <0x14>; + interrupt-parent = <&gpio1>; + interrupts = ; + irq-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&touch_int>, <&touch_rst>; + pinctrl-names = "default"; + reset-gpios = <&gpio1 RK_PA7 GPIO_ACTIVE_HIGH>; + touchscreen-inverted-x; + touchscreen-size-x = <1080>; + touchscreen-size-y = <1920>; + touchscreen-swapped-x-y; + }; +}; + +&i2c4 { + pinctrl-0 = <&i2c4m2_xfer>; + status = "okay"; + + ti_adc: adc@48 { + compatible = "ti,ads1015"; + reg = <0x48>; + #address-cells = <1>; + #io-channel-cells = <1>; + #size-cells = <0>; + + channel@4 { + reg = <4>; + }; + + channel@5 { + reg = <5>; + }; + + channel@6 { + reg = <6>; + }; + + channel@7 { + reg = <7>; + }; + }; + + imu@68 { + compatible = "invensense,mpu6880"; + reg = <0x68>; + interrupt-parent = <&gpio0>; + interrupts = ; + }; +}; + +&i2c6 { + pinctrl-0 = <&i2c6m3_xfer>; + status = "okay"; + + /* + * vbus-supply provided by ti,bq27503 which does not yet have + * a driver. Leaving unpopulated until a driver can be written. + */ + fusb302: typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&usbc0_int>; + pinctrl-names = "default"; + + connector { + compatible = "usb-c-connector"; + data-role = "dual"; + label = "USB-C"; + op-sink-microwatt = <1000000>; + power-role = "dual"; + self-powered; + sink-pdos = ; + source-pdos = ; + try-power-role = "sink"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_orien_sw: endpoint { + remote-endpoint = <&usbdp_phy0_orientation_switch>; + }; + }; + + port@1 { + reg = <1>; + usbc0_role_sw: endpoint { + remote-endpoint = <&dwc3_0_role_switch>; + }; + }; + + port@2 { + reg = <2>; + dp_altmode_mux: endpoint { + remote-endpoint = <&usbdp_phy0_dp_altmode_mux>; + }; + }; + }; + }; + }; + + rtc_hym8563: rtc@51 { + compatible = "haoyu,hym8563"; + reg = <0x51>; + #clock-cells = <0>; + clock-output-names = "hym8563"; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&hym8563_int>, <&clk32k_in>; + pinctrl-names = "default"; + wakeup-source; + }; + + /* Battery profile from BSP device tree. */ + cw2015@62 { + compatible = "cellwise,cw2015"; + reg = <0x62>; + + cellwise,battery-profile = /bits/ 8 + <0x18 0x0A 0x76 0x6A 0x6A 0x6A 0x68 0x66 + 0x62 0x5E 0x5A 0x58 0x5F 0x59 0x46 0x3D + 0x35 0x2D 0x28 0x21 0x29 0x38 0x44 0x50 + 0x1A 0x85 0x07 0xAE 0x14 0x28 0x48 0x56 + 0x66 0x66 0x66 0x6A 0x3E 0x1A 0x6C 0x3D + 0x09 0x38 0x1A 0x49 0x7B 0x96 0xA2 0x15 + 0x3B 0x77 0x9A 0xB1 0x80 0x87 0xB0 0xCB + 0x2F 0x00 0x64 0xA5 0xB5 0x1C 0xF0 0x49>; + cellwise,dual-cell; + cellwise,monitor-interval-ms = <5000>; + monitored-battery = <&battery>; + power-supplies = <&fusb302>; + status = "okay"; + }; + + /* + * At 0x6b there is a Texas Instruments bq25703 for which no + * driver currently exists. The physical USB-C port is wired + * into the fusb302, and the power lines are run through the + * bq25703 which is used to either charge the battery when the + * port is used as a sink or power the port when it is used as + * a source. + */ +}; + +&i2c7 { + status = "okay"; + + es8388: audio-codec@11 { + compatible = "everest,es8388"; + reg = <0x11>; + assigned-clock-rates = <12288000>; + assigned-clocks = <&cru I2S0_8CH_MCLKOUT>; + AVDD-supply = <&vcc_3v3_s3>; + clocks = <&cru I2S0_8CH_MCLKOUT>; + DVDD-supply = <&vcc_1v8_s3>; + HPVDD-supply = <&vcc_3v3_s3>; + PVDD-supply = <&vcc_1v8_s3>; + #sound-dai-cells = <0>; + }; +}; + +&i2s0_8ch { + pinctrl-0 = <&i2s0_lrck + &i2s0_mclk + &i2s0_sclk + &i2s0_sdi0 + &i2s0_sdo0>; + status = "okay"; +}; + +&package_thermal { + polling-delay = <1000>; + + trips { + package_fan0: package-fan0 { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + + package_fan1: package-fan1 { + temperature = <65000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map1 { + trip = <&package_fan0>; + cooling-device = <&pwm_fan THERMAL_NO_LIMIT 1>; + }; + + map2 { + trip = <&package_fan1>; + cooling-device = <&pwm_fan 2 THERMAL_NO_LIMIT>; + }; + }; +}; + +/* + * Attempts to use an M.2 SATA in this slot worked intermittently + * with the correct nodes enabled in device-tree, but eventually + * resulted in a destroyed board. Advise caution. + */ +&pcie2x1l1 { + pinctrl-0 = <&pcie_rst>; + pinctrl-names = "default"; + reset-gpios = <&gpio3 RK_PD1 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&pinctrl { + audio-amplifier { + hp_detect: headphone-detect { + rockchip,pins = + <3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + headphone_amplifier_en: headphone-amplifier-en { + rockchip,pins = + <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + speaker_amplifier_en: speaker-amplifier-en { + rockchip,pins = + <4 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = + <3 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = + <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = + <3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + charger { + charger_int_h: charger-int-h { + rockchip,pins = + <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + hym8563 { + hym8563_int: hym8563-int { + rockchip,pins = + <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-btns { + btn_pins_ctrl: btn-pins-ctrl { + rockchip,pins = + <1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PB7 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>, + <1 RK_PD7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + gpio-leds { + led_pins: led-pins { + rockchip,pins = + <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>, + <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + pcie-pins { + pcie_rst: pcie-rst { + rockchip,pins = + <3 RK_PD1 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + sd-pwr { + sd_s0_pwr: sd-s0-pwr { + rockchip,pins = + <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + spk-pwr { + vcc5v0_spk_pwr: vcc5v0-spk-pwr { + rockchip,pins = + <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + touch { + touch_int: touch-int { + rockchip,pins = + <1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + touch_rst: touch-rst { + rockchip,pins = + <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = + <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + vcc3v3-lcd { + vcc_lcd_h: vcc-lcd-h { + rockchip,pins = + <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + vibrator { + vib_left_h: vib-left-h { + rockchip,pins = + <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + vib_right_h: vib-right-h { + rockchip,pins = + <1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + wifi { + wifi_enable_h: wifi-enable-h { + rockchip,pins = + <3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + wifi_host_wake_irq: wifi-host-wake-irq { + rockchip,pins = + <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; +}; + +&pwm12 { + pinctrl-0 = <&pwm12m1_pins>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcc_1v8_s0>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + no-sd; + no-sdio; + non-removable; + status = "okay"; +}; + +&sdio { + #address-cells = <1>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + disable-wp; + keep-power-in-suspend; + max-frequency = <150000000>; + mmc-pwrseq = <&sdio_pwrseq>; + no-mmc; + no-sd; + sd-uhs-sdr104; + #size-cells = <0>; + status = "okay"; + + brcmf: wifi@1 { + compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac"; + reg = <1>; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + pinctrl-0 = <&wifi_host_wake_irq>; + pinctrl-names = "default"; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + max-frequency = <150000000>; + no-sdio; + no-mmc; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3_sd_s0>; + vqmmc-supply = <&vccio_sd_s0>; + status = "okay"; +}; + +&spi2 { + #address-cells = <1>; + assigned-clocks = <&cru CLK_SPI2>; + assigned-clock-rates = <200000000>; + num-cs = <1>; + pinctrl-0 = <&spi2m2_pins>, <&spi2m2_cs0>; + pinctrl-names = "default"; + #size-cells = <0>; + status = "okay"; + + pmic@0 { + compatible = "rockchip,rk806"; + reg = <0x0>; + #gpio-cells = <2>; + gpio-controller; + interrupt-parent = <&gpio0>; + interrupts = ; + pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>, + <&rk806_dvs2_null>, <&rk806_dvs3_null>; + pinctrl-names = "default"; + spi-max-frequency = <1000000>; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc5v0_sys>; + vcc6-supply = <&vcc5v0_sys>; + vcc7-supply = <&vcc5v0_sys>; + vcc8-supply = <&vcc5v0_sys>; + vcc9-supply = <&vcc5v0_sys>; + vcc10-supply = <&vcc5v0_sys>; + vcc11-supply = <&vcc_2v0_pldo_s3>; + vcc12-supply = <&vcc5v0_sys>; + vcc13-supply = <&vcc_1v1_nldo_s3>; + vcc14-supply = <&vcc_1v1_nldo_s3>; + vcca-supply = <&vcc5v0_sys>; + + rk806_dvs1_null: dvs1-null-pins { + pins = "gpio_pwrctrl1"; + function = "pin_fun0"; + }; + + rk806_dvs2_null: dvs2-null-pins { + pins = "gpio_pwrctrl2"; + function = "pin_fun0"; + }; + + rk806_dvs3_null: dvs3-null-pins { + pins = "gpio_pwrctrl3"; + function = "pin_fun0"; + }; + + regulators { + vdd_gpu_s0: dcdc-reg1 { + regulator-boot-on; + regulator-enable-ramp-delay = <400>; + regulator-max-microvolt = <950000>; + regulator-min-microvolt = <550000>; + regulator-name = "vdd_gpu_s0"; + regulator-ramp-delay = <12500>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_lit_s0: dcdc-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <950000>; + regulator-min-microvolt = <550000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_cpu_lit_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_logic_s0: dcdc-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <750000>; + regulator-min-microvolt = <675000>; + regulator-name = "vdd_logic_s0"; + regulator-ramp-delay = <12500>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_vdenc_s0: dcdc-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <950000>; + regulator-min-microvolt = <550000>; + regulator-name = "vdd_vdenc_s0"; + regulator-ramp-delay = <12500>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_ddr_s0: dcdc-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <675000>; + regulator-max-microvolt = <900000>; + regulator-ramp-delay = <12500>; + regulator-name = "vdd_ddr_s0"; + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + vdd2_ddr_s3: dcdc-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vdd2_ddr_s3"; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_2v0_pldo_s3: dcdc-reg7 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <2000000>; + regulator-min-microvolt = <2000000>; + regulator-name = "vdd_2v0_pldo_s3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <2000000>; + }; + }; + + vcc_3v3_s3: dcdc-reg8 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_3v3_s3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vddq_ddr_s0: dcdc-reg9 { + regulator-always-on; + regulator-boot-on; + regulator-name = "vddq_ddr_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3: dcdc-reg10 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avcc_1v8_s0: pldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "avcc_1v8_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s0: pldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vcc_1v8_s0"; + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + avdd_1v2_s0: pldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1200000>; + regulator-min-microvolt = <1200000>; + regulator-name = "avdd_1v2_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v3_s0: pldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <3300000>; + regulator-name = "vcc_3v3_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd_s0: pldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <3300000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vccio_sd_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v8_s3_pldo6: pldo-reg6 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1800000>; + regulator-min-microvolt = <1800000>; + regulator-name = "vcc_1v8_s3_pldo6"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_0v75_s3: nldo-reg1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <750000>; + regulator-min-microvolt = <750000>; + regulator-name = "vdd_0v75_s3"; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <750000>; + }; + }; + + vdd_ddr_pll_s0: nldo-reg2 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <850000>; + regulator-min-microvolt = <850000>; + regulator-name = "vdd_ddr_pll_s0"; + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <850000>; + }; + }; + + avdd_0v75_s0: nldo-reg3 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <837500>; + regulator-min-microvolt = <837500>; + regulator-name = "avdd_0v75_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v85_s0: nldo-reg4 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-name = "vdd_0v85_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_0v75_s0: nldo-reg5 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <750000>; + regulator-name = "vdd_0v75_s0"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; +}; + +&tsadc { + status = "okay"; +}; + +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + +&uart2 { + pinctrl-0 = <&uart2m0_xfer>; + status = "okay"; +}; + +&uart9 { + pinctrl-0 = <&uart9m2_xfer>, <&uart9m2_ctsn>, <&uart9m2_rtsn>; + uart-has-rtscts; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rtc_hym8563>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_HIGH>; + interrupt-parent = <&gpio3>; + interrupts = ; + pinctrl-0 = <&bt_enable_h>, <&bt_host_wake_l>, <&bt_wake_l>; + pinctrl-names = "default"; + shutdown-gpios = <&gpio3 RK_PB7 GPIO_ACTIVE_HIGH>; + }; +}; + +&usb_host0_xhci { + dr_mode = "otg"; + usb-role-switch; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + dwc3_0_role_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_role_sw>; + }; + }; +}; + +&usbdp_phy0 { + mode-switch; + orientation-switch; + sbu1-dc-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA1 GPIO_ACTIVE_HIGH>; + rockchip,dp-lane-mux = <2 3>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_orientation_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_orien_sw>; + }; + + usbdp_phy0_dp_altmode_mux: endpoint@1 { + reg = <1>; + remote-endpoint = <&dp_altmode_mux>; + }; + }; +};