From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=67.231.154.183 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796169143; b=L9eTa7DahcHBA+xIOuOAlMy6vYsm0diolGgRQpL0sMS2BplbUEWYArKS7nS0bvvRF2Ip lZg6J2CNTloHOJW522eDDWzCHb+tB5LI2Vil9/V+Bcq2jb15V29EcZ7GSr6TBqApDGAPH WyPb0SPdueIeKOLZSe/MFzG7B7L9nkSozNVMRknTgXe9dl4GRjD6d+zvkVaDJOWlRLfkn AajZjbeAesin2Xx9fAqdr+Pv4aHsAsna3K58m/6q25vyNaAn/hmBVu4JKbunsfHn6+Y87 33XiZ1btopmR2KNZzv2hOfsJqujk93IJSSCmSgDA9zaAzrHQC25P3xTW4cQrytTutmw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796169143; h=DMARC-Filter:DKIM-Signature:X-Virus-Scanned:Received:DKIM-Signature: Received:Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date: Message-ID:References:In-Reply-To:Accept-Language:Content-Language: X-MS-Has-Attach:X-MS-TNEF-Correlator:x-ms-publictraffictype: x-ms-traffictypediagnostic:x-ms-office365-filtering-correlation-id: x-ms-exchange-senderadcheck:x-ms-exchange-antispam-relay: x-microsoft-antispam:x-microsoft-antispam-message-info: x-forefront-antispam-report: x-ms-exchange-antispam-messagedata-chunkcount: x-ms-exchange-antispam-messagedata-0:Content-Type: Content-Transfer-Encoding:MIME-Version: X-Exchange-RoutingPolicyChecked:X-OriginatorOrg: X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-AuthSource: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-originalarrivaltime: X-MS-Exchange-CrossTenant-fromentityheader: X-MS-Exchange-CrossTenant-id:X-MS-Exchange-CrossTenant-mailboxtype: X-MS-Exchange-CrossTenant-userprincipalname: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-MDID:X-PPE-STACK: X-MDID-O:X-PPE-TRUSTED; bh=BrVQuRy1cuW1T7QeB5I5H9Dq7iE27gwwoZR6eaBn2jQ=; b=GrOmFrBhZxo1mNOtfgs4B1StXz4NO8bCfIv0UT/X3d5teYnHedULLtMHlvHX+aoX2mjV vJ3t2aKZiuw7c06I8y2PWPszCoTw5ugiMCIoEG46FMKpU/qjFlTzMtaP5GtDBePZa76Xw +ZlhaiGIjx6Hp/MGuJGEr7rf99Pi4NbxC06PNLwtu1NdFEEa4/jpIkdCceEjWxyrmXLZQ xjBIjL/0p82rtkoyK1nD4V/yI//Ue2Paegvhc9SoiTVbqGs9T9twche49uCsyFLzajtzD johP6b/xeeg8pFm4aMl3FEFaucMsv64PBQhA97EydzlhTBAA/vcpwHejCRiNQ+dIwVg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=sitime.com; spf=pass smtp.mailfrom=sitime.com; dkim=pass header.d=sitime.com header.i=@sitime.com header.a=rsa-sha256 header.s=mail header.b=id33Brpy; dkim=pass header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=KpLUJZ+D; arc=pass header.oldest-pass=0 smtp.remote-ip=67.231.154.183 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40B66606BAFD; Tue, 1 Dec 2026 23:52:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 40B66606BAFD Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sitime.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sitime.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sitime.com header.i=@sitime.com header.a=rsa-sha256 header.s=mail header.b=id33Brpy; dkim=pass (2048-bit key) header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=KpLUJZ+D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sitime.com; h=cc:cc:content-transfer-encoding:content-transfer-encoding:content-type:content-type:date:date:from:from:in-reply-to:in-reply-to:message-id:message-id:mime-version:mime-version:references:references:subject:subject:to:to; s=mail; bh=BrVQuRy1cuW1T7QeB5I5H9Dq7iE27gwwoZR6eaBn2jQ=; b=id33Brpy6mU3dmvI84CuSGTQVeaBlFWbTXWKLrdHUyZbe+kBPscfZIrf3NBh87AkOCdwiEDunhdl6vW4jm0RN52k5m6PMASJwWDzvFDGdV97/sywN7DIe5xL43QDSnOrv4XvKYpnjTqlvh5w1+bL/MuEtWmYXS2Y6huFeJBonMMILOcurqAiPfpFwMt9AGpmFJX/suoJ4JqqZ3xerZVWGka1Lts+mciz8jmFVNANaYD8gGT9OMi78uj1AafW+3kmFXsc0cKBKIZzTpyMeLBvLam16krJmZVtW1LDlDjeRj1WPLrN1vk10RYjzGHjjl9ccdsWyDBr/WDudnhrpyzkpg== X-Virus-Scanned: Proofpoint Essentials engine Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11020129.outbound.protection.outlook.com [52.101.201.129]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 1E47624006D; Tue, 1 Dec 2026 23:52:20 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=noh+hQrErrlMESt5aISt7WbwHDd3z6VgSRVFpnTkgGZGjNAdwmOYXpY543cYuLn+J7+dhKWZhJMfyda1ils4+iV+4h5M6jfmzb5nWHUeaoo7JYrG6AD9n75OK9FZYac6pDzbb4x1QwNZa727JR4DdxsscpE7uOsR7JoeONKGQLBxsQDrrgSkJ7ax207kNFrX5q2+43WQ8zVoGugEXkIw94SzXciAKCt8W+44v9KkxfwWgcJrN2+WnKd4uizYR5D2fXvA2djxkzuDihfrlJeJbIHdF3BWmysVhV9qA76ROAYeIJcNN5+FJPxIJthLNmLsdwTHJhRXPJP89xnQzI/l0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BrVQuRy1cuW1T7QeB5I5H9Dq7iE27gwwoZR6eaBn2jQ=; b=I39NnGRr+6cgQ9yOgqsv8osqnilqlM3rZCOTn/xnIUELXhxSEsFdzDACriWVSq0J4nxLhpyOnSWblB2cVDqV0ANPe5A0M3d8gDa5twYf3aK4P6GK9z4bWl/Fb7CsMyRMB8sOtI0GdKxKcUGgb/WwSljVab46XQUQ62XuRlkxW6DODyRVujHxAZknkyrtLxlJE9m0BHXpxyCgpjstYZCpBH197a645kZ7Tu4CcYDOq6l0rkqhQF5YOdn5dBdXM3ifu8hnf8B7Y13eadczzXMBZwXu97Vylg1TwvZ4ouTgVDkC8WMSV95kwtPfhq7bOpqSlIITJij4pffNzJ73pTHWmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sitime.com; dmarc=pass action=none header.from=sitime.com; dkim=pass header.d=sitime.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Sitime.onmicrosoft.com; s=selector1-Sitime-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BrVQuRy1cuW1T7QeB5I5H9Dq7iE27gwwoZR6eaBn2jQ=; b=KpLUJZ+D5OODMDqC10cWS27YFeaPfRDLTVV+eV+m3G+TFF10wJbeoS0aIAu8h6pLGqOHcVngznTP/aozqLvciOrPvTC0c6hAlvLb0UYFT6zCWwu/v9/3hpV5Ga5WT7ytcB8ScvIIvXxYnxTRNFcbgR7zBzJWclvOCFwEX0wRUR0xDuNvSyIefOSojmYJuw32LuPMnpgf+bQEptCcX6Z6FzVC1omZQHResFQTwEBB4gI/wF+pW3zAU5lXq8EUnJzSddkabKiib9LAfJdU7dSF2cufozcjiDCvJtV4LTfdy6Fpha1GNi9k2NA8p+VU+DvmaVLn5KC4keE8ps9C0G4jpQ== Received: from LVWPR20MB994915.namprd20.prod.outlook.com (2603:10b6:408:3bf::16) by SJ2PR20MB6330.namprd20.prod.outlook.com (2603:10b6:a03:502::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 23:52:16 +0000 Received: from LVWPR20MB994915.namprd20.prod.outlook.com ([fe80::9551:3864:128b:8c01]) by LVWPR20MB994915.namprd20.prod.outlook.com ([fe80::9551:3864:128b:8c01%4]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 23:52:16 +0000 From: Ali Rouhi To: "jiri@resnulli.us" CC: "ivecera@redhat.com" , "vadim.fedorenko@linux.dev" , "arkadiusz.kubalewski@intel.com" , "kuba@kernel.org" , "pabeni@redhat.com" , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "prabhakar.mahadev-lad.rj@bp.renesas.com" , "cjubran@nvidia.com" , "Oleg.Zadorozhnyi@devoxsoftware.com" , "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL Thread-Topic: [PATCH net-next v17 10/13] dpll: sit9531x: implement output pin state on a DPLL Thread-Index: AQHdge75brdbhxb4Ck+TMkoSTxoKHA== Date: Tue, 1 Dec 2026 23:52:07 +0000 Message-ID: <20261201235202.97645-11-arouhi@sitime.com> References: <20261201235202.97645-1-arouhi@sitime.com> In-Reply-To: <20261201235202.97645-1-arouhi@sitime.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=sitime.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LVWPR20MB994915:EE_|SJ2PR20MB6330:EE_ x-ms-office365-filtering-correlation-id: a43480c1-2a0e-419e-ff10-08df50062127 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|1800799024|23010399003|366016|38070700021|10067099003|56012099006|5023799004|261022075727099003|261026121527099003|261021123027099003|261021121427099003|261026140227099003|261022105027099003|261028144727099003|261102123227099003|261009223027099003|261009221227099003|22082099003|18002099003|6133799003|3023799007; x-microsoft-antispam-message-info: xRpXeMMlUjZEgpnGarF4iu99cP+xAtjadJWBc8mBAn6yzfX1q00XQn++jkLdPuy5feGZd+QtlNusdC2xWzrX7Fv4bMBHWk+ykoFJtJKtLffh9Ryqxf/4p7ZBOXP6GdF1ZCowFPhEqF2RjswWjSXHWkTwc5dIUCdiopN91O3134OJIUZv80oWBvSWGXJRDWheH60Zpz2BOjuTI2ng/QMirRJd03z9FScEw7bvVm49/OahQgj9x3x9AsmnLXBjbRr9nGoT1tWoYsLwLnCx43tQQWPQXLkm6Q6LVCyZX7F1g2UrRjMrTs+HwaE7/aqb5TjBxDV1ZgDIsGpqpVqVbLO9u1APGiYsx+t18RSKdQcVRiyAPt/PRumzsJv890oY+fkMOih91F6WCnomOCJKctZy9LHcF4tzd24iX3E1CltP7ZzviDt4mFwU9P9P0abdg6d6s9mwfrm8Wrj8C60K2F1iP+wF6s4B+csXoZVzMJByMczK0VfaKkL1fKNmYYU/dZID79vJXA+bUG7+f+Twq3z/xBqKjz4SYrliWUoqK2T27YepbqYp5HYY+ht+mJh+7cACnTRLKanMeR4uEGWNoDzvIp/aZ9wQtgKcURSJo083l7CbtNJtALOUNuk1gtj5yAKSe/R+ctB5RuTjYYWa+cTOMPvp/KmaeFaxjlp902AvNybmqs4UY/v2+N5I9qZx71V914+HeGXpOAc1jwSKcOi1KTrmyJpM7QbcKEHU/LZxhHI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LVWPR20MB994915.namprd20.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(23010399003)(366016)(38070700021)(10067099003)(56012099006)(5023799004)(261022075727099003)(261026121527099003)(261021123027099003)(261021121427099003)(261026140227099003)(261022105027099003)(261028144727099003)(261102123227099003)(261009223027099003)(261009221227099003)(22082099003)(18002099003)(6133799003)(3023799007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?2zA/o9lPyNXJCjCqDzFPAt4Rj0tMFuj982aXayaSAyDbE/3gcT40gQ7sqF?= =?iso-8859-1?Q?gtLY4JsqOGwuIdzR6lFRVaYAagfE4JVyfa9smiZqzOzz9pc/eSfk6lGDeV?= =?iso-8859-1?Q?syDI7nQLUgO2+DnJl6FWB1p+bmVv08yST2OHkRX9Gvt92PItPwlxMbuanl?= =?iso-8859-1?Q?vrlsEmRdhJF6sI/GCplCegyMZSHY6PjbhEe/Ep2ueyzG+HwenSfBHJ9bp2?= =?iso-8859-1?Q?cHYT3l9YefpU9ZYfz5kjndeLikUOUuR4oUrUn1Apb+yg8uiHKXS7vNmipr?= =?iso-8859-1?Q?jyvcDIl1AlB6k9uh/77fJqrF5U/fE9LbiRJQythkV7gAeagMi6UUaLiLRc?= =?iso-8859-1?Q?Ax2rsCvncAekT2CN3roJqpCqfoeQo7oGjnyMgUgYdLwFNP0NuXZCOiXa/0?= =?iso-8859-1?Q?qDXeU+lCIhK02XEpFcY4+iYQtb+1Y4fmmwd/mxAqOFczk6ey39uZdxL+m/?= =?iso-8859-1?Q?l60BoGaMDr3vBp6TA7zXln5Mv3vXiDjawqoDy8ncJ8X075avv/BpvaMnLj?= =?iso-8859-1?Q?c8ntAs3p/OZLYdDeZRQL35lDzQlMGGUDopidze6FKhwcmb4FLw9QogY/+E?= =?iso-8859-1?Q?F77g9ChEkvifaOLSb+6GPLCRZRhsuTqgh5SnRgKv7U8bsAgoMedpz5S0uS?= =?iso-8859-1?Q?he3pqxT/O1VMxragTtZPitAucTXkGmn5CjdWo8U7blJJKRtvE1PeBcraBV?= =?iso-8859-1?Q?vs2U3YJMAnYZFZLK9aA8KCL96y/vkxJelNJ2KGKaZqYhkYuJlhoWe0nOyg?= =?iso-8859-1?Q?VLfRv9efBd52f9PxaunMC3E2UmjXPq/a+pfOhnXZfSF/wEb2Obp7wKQ1Ws?= =?iso-8859-1?Q?NdmSE4R3rq76uWQJ7NA/zHgE5ITrk1rk1nx3OACF8kpPTi98zq/5QkSFhX?= =?iso-8859-1?Q?O6eAGM+70DNi+kbR4XpuUWzgrHP1rtXDkWezUa8xHnt79tGKD7czqvfZsz?= =?iso-8859-1?Q?AFJTiMhMWcb2nFymDinD54JTNjrgZyFOewJPEYpmh1is/0vQtHuBOh2gAd?= =?iso-8859-1?Q?Ghyjakjsr7RHvDVSFNk+M+nO2Vrg7TEZNsycOuNUJwmjpkYPLFqxyyplcv?= =?iso-8859-1?Q?Hi8TRFv/Cspnr+vQHqdIWuCVSRxP1SZHn19R5ubRlcCxWpU4qwLvQpVsOR?= =?iso-8859-1?Q?atyEnh+OQF+4Vq9h8yVN3v0Zy1bo/n4m+b+V17DdmcZREjn++JRq9tL+wz?= =?iso-8859-1?Q?Aaam20VobsNut5YloYNzi8exgaoTIwCJ8u2LesL4e6HoKwYR0zPsnOb92D?= =?iso-8859-1?Q?64lWpk1jyf/fyOc9gCQdI+5pFj1uxMzrg9EuBDMIOTnn2y4D+OyDt0wKJj?= =?iso-8859-1?Q?eHbLrC3n84GAK8AMhS+YYi8QCOvCybHHSu8z6w6/mMRQ3UDNFaTtgvINly?= =?iso-8859-1?Q?w6iTzKw0MEVbnge9hmlf6B+gyaZAKuZ51jX2E+YMLRZ0NycPyky5C7lgJz?= =?iso-8859-1?Q?/glQdsxIOzlOo3RLNkAM13J8Z7TuCs7B0WydzKhu8tV8Y54ryeq7zUXYGj?= =?iso-8859-1?Q?ZlKdCelf7FB6VqKL8x2B3i0zHlyr9VgrSOGbE3I7NEhtn+VT6uwxo3zunm?= =?iso-8859-1?Q?sDTZaPGc+zcvJ6hCbVYL/5F6dmZR3t4PpIFqiEyChWroGpLC4nq8NgWVGJ?= =?iso-8859-1?Q?VXQnEJUDg5lkfl/2pkY5uxZgGe+3V1B4lddcVF5nufcN3otC2cqyqJ6KhO?= =?iso-8859-1?Q?1ASC5fMxnhwBsnC9/pQ01wQpEC/J8N5KwzPRiDpduZB4o4NRrC3VstxfAQ?= =?iso-8859-1?Q?+/YDMnhRFBii7jksMv0fqfPxPvA+zU3fkggebxTSSKvgY7?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Exchange-RoutingPolicyChecked: inTDAK7+dYU15z7XNjRROEx98ZLplCRLYy/H2x+zJnENhplQCKGbmKZr61e3fXE8eAjibytRBvabmhWval1nYoXDPs/puZsWdR20VLg4lNpsf0ucYPzXOSNqx6x+J1VpsEdakFfRIl3wQzsq6dOQDg37CD0m+EqX5CIB4VBCU276r3sb681WH+FsaO47RNLPPo9lCWVydYcJ27bRSdRFNXcJA9V8R1/yDeB+FV0BjfaZU3kDTR8FiPWLXLFZXy/2QY2z886xBqJxsLjaqyBPDg6G7CbHzVLKHlFUDz4SHhp+ttGTeJ8wZnmgTLLCcMY7IzgMXTL9wloqBuJdNpDG0A== X-OriginatorOrg: sitime.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LVWPR20MB994915.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a43480c1-2a0e-419e-ff10-08df50062127 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2026 23:52:07.6698 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8fb55916-cf10-4b0d-96f4-cf3952657263 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: e02ouVenEiK3STEjjeJzJug904/lJadMcqbZk1a/Yh5dwjMP2AsmkSxzBG5g0OsKgW3y8yaQcdAG4LuNHSmrPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR20MB6330 X-MDID: 1796169140-Iv4scnnz-HrW X-PPE-STACK: {"stack":"us1"} X-MDID-O: us1;at1;1796169140;Iv4scnnz-HrW;;ba04557de9d2da8490f5f1e6de07b967 X-PPE-TRUSTED: V=1;DIR=OUT; From: Oleg Zadorozhnyi =0A= =0A= An output's state says whether it carries a signal: CONNECTED while it=0A= drives, DISCONNECTED while muted. Setting it forces the output's pads to=0A= Hi-Z, which leaves the divider running. Output pins are registered from=0A= this patch on.=0A= =0A= A mute forces the slot's three Hi-Z pairs, differential, CMOS OutP and=0A= CMOS OutN, with the Page 3 debug window open; the force registers are=0A= outside the NVM, so no programming directive is written. Probe records=0A= the override the loaded configuration sets on each pair, and an unmute=0A= writes that record back, so a pad the configuration forces stays forced.=0A= An output is reported muted only when both pads are forced off. A rebind=0A= takes the force registers as found: a pair forced on an output found=0A= muted is taken as the mute, also one an earlier binding set, so an=0A= unmute drives every pad.=0A= =0A= The programming state of the previous patch now has one exit, which=0A= locks the output loops and closes the output-system debug key. A lock or=0A= a close that did not take effect is retried by the poll and at removal.=0A= =0A= Signed-off-by: Oleg Zadorozhnyi =0A= Co-developed-by: Ali Rouhi =0A= Signed-off-by: Ali Rouhi =0A= ---=0A= drivers/dpll/sit9531x/core.c | 369 ++++++++++++++++++++++++++++-------=0A= drivers/dpll/sit9531x/core.h | 25 ++-=0A= drivers/dpll/sit9531x/dpll.c | 153 ++++++++++++++-=0A= 3 files changed, 467 insertions(+), 80 deletions(-)=0A= =0A= diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c=0A= index bce58b337113..3316e3761e16 100644=0A= --- a/drivers/dpll/sit9531x/core.c=0A= +++ b/drivers/dpll/sit9531x/core.c=0A= @@ -335,8 +335,9 @@ int sit9531x_input_enable(struct sit9531x_dev *sitdev, = u8 index)=0A= /*=0A= * Output Hi-Z control: each slot has three force/state pairs on Page 0x03= ,=0A= * for the differential path and the CMOS OutP and OutN pads. The tri-stat= e=0A= - * buffers sit after the output driver, independent of the pad selection.= =0A= - * ODRn_MISC0 bits 3:2 distinguish a CMOS output from a differential one.= =0A= + * buffers sit after the output driver, independent of the pad selection, = and=0A= + * a mute writes all three. ODRn_MISC0 bits 3:2 distinguish a CMOS output = from=0A= + * a differential one.=0A= *=0A= * slot 0-7 :=0A= * DIFF 0xF2/0xF3 CMOS OutP 0xF8/0xF9 CMOS OutN 0xF6/0xF7=0A= @@ -439,14 +440,16 @@ static int sit9531x_hiz_pair_forced(struct sit9531x_d= ev *sitdev,=0A= static int sit9531x_output_forced_hiz(struct sit9531x_dev *sitdev,=0A= u8 out_idx, bool *muted, bool *part)=0A= {=0A= + const struct sit9531x_out *out =3D &sitdev->out[out_idx];=0A= struct sit9531x_hiz_pair p[SIT9531X_HIZ_PAIRS];=0A= bool pad_p, pad_n;=0A= + u8 keep;=0A= int rc;=0A= =0A= sit9531x_output_get_hiz_regs(sitdev->info->clkout_map[out_idx], p);=0A= =0A= *part =3D false;=0A= - if (!sitdev->out[out_idx].cmos)=0A= + if (!out->cmos)=0A= return sit9531x_hiz_pair_forced(sitdev,=0A= &p[SIT9531X_HIZ_DIFF], muted);=0A= =0A= @@ -457,44 +460,91 @@ static int sit9531x_output_forced_hiz(struct sit9531x= _dev *sitdev,=0A= if (rc)=0A= return rc;=0A= =0A= + /* A pad the loaded configuration forces is not a part mute */=0A= + keep =3D out->hiz_mask & ~out->hiz_state;=0A= *muted =3D pad_p && pad_n;=0A= - *part =3D pad_p !=3D pad_n;=0A= + *part =3D pad_p !=3D pad_n &&=0A= + !(keep & BIT(pad_p ? SIT9531X_HIZ_CMOS_P :=0A= + SIT9531X_HIZ_CMOS_N));=0A= =0A= return 0;=0A= }=0A= =0A= -#define SIT9531X_LOOP_LOCK_TRIES 3=0A= +/* Re-read an output's mute state. Caller must hold sitdev->multiop_lock. = */=0A= +int sit9531x_output_state_refresh(struct sit9531x_dev *sitdev, u8 out_idx)= =0A= +{=0A= + bool muted, part;=0A= + int rc;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + rc =3D sit9531x_output_forced_hiz(sitdev, out_idx, &muted, &part);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + sitdev->out[out_idx].enabled =3D !muted;=0A= + sitdev->out[out_idx].part_muted =3D part;=0A= + sitdev->out[out_idx].state_stale =3D false;=0A= +=0A= + return 0;=0A= +}=0A= =0A= -/* Close the loops and lock the debug block without committing */=0A= -static void sit9531x_prg_abort(struct sit9531x_dev *sitdev)=0A= +static int sit9531x_hiz_set_bit(struct sit9531x_dev *sitdev,=0A= + unsigned int reg, u8 bit, bool set)=0A= {=0A= - int rc =3D -EIO;=0A= - u8 attempt;=0A= + u8 cur, new_val;=0A= + int rc;=0A= =0A= - for (attempt =3D 0; attempt < SIT9531X_LOOP_LOCK_TRIES; attempt++) {=0A= - rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= - SIT9531X_LOOP_LOCK);=0A= - if (!rc)=0A= - break;=0A= - usleep_range(1000, 2000);=0A= - }=0A= + rc =3D sit9531x_read_u8(sitdev, reg, &cur);=0A= if (rc)=0A= - dev_err(sitdev->dev,=0A= - "output loops left unlocked after a failed entry: %d\n",=0A= - rc);=0A= + return rc;=0A= =0A= - sitdev->loops_open =3D !!rc;=0A= - sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_LOCK_VAL);=0A= + new_val =3D set ? (cur | BIT(bit)) : (cur & ~BIT(bit));=0A= +=0A= + return sit9531x_write_u8(sitdev, reg, new_val);=0A= +}=0A= +=0A= +/*=0A= + * The Page 3 debug key opens every debug register of the output system wh= ile=0A= + * it holds the unlock value.=0A= + */=0A= +static int sit9531x_outsys_debug_open(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc, lock_rc;=0A= +=0A= + rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_UNLOCK_VAL);=0A= + if (rc) {=0A= + lock_rc =3D sit9531x_write_close(sitdev,=0A= + SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= + sitdev->outsys_key_pending =3D !!lock_rc;=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +static void sit9531x_outsys_debug_close(struct sit9531x_dev *sitdev)=0A= +{=0A= + int rc;=0A= +=0A= + rc =3D sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= + SIT9531X_DEBUG_LOCK_VAL);=0A= + sitdev->outsys_key_pending =3D !!rc;=0A= + if (rc)=0A= + dev_warn(sitdev->dev, "output debug block left unlocked: %d\n",=0A= + rc);=0A= }=0A= =0A= +#define SIT9531X_LOOP_LOCK_TRIES 3=0A= +=0A= /*=0A= * Leave PRG_CMD: re-lock the loops and close the debug window. The sleep = is=0A= * the settling time after loop lock.=0A= */=0A= static int sit9531x_prg_relock(struct sit9531x_dev *sitdev)=0A= {=0A= - int rc =3D 0, close_rc;=0A= + int rc =3D 0;=0A= u8 attempt;=0A= =0A= for (attempt =3D 0; attempt < SIT9531X_LOOP_LOCK_TRIES; attempt++) {=0A= @@ -513,16 +563,7 @@ static int sit9531x_prg_relock(struct sit9531x_dev *si= tdev)=0A= =0A= msleep(100);=0A= =0A= - /*=0A= - * The debug key register unlocks every debug register while it holds=0A= - * the unlock value.=0A= - */=0A= - close_rc =3D sit9531x_write_close(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_LOCK_VAL);=0A= - if (close_rc)=0A= - dev_warn(sitdev->dev,=0A= - "output debug block left unlocked after programming: %d\n",=0A= - close_rc);=0A= + sit9531x_outsys_debug_close(sitdev);=0A= =0A= return rc;=0A= }=0A= @@ -530,20 +571,11 @@ static int sit9531x_prg_relock(struct sit9531x_dev *s= itdev)=0A= /* Retry a failed loop re-lock with the debug window open, as the first tr= y */=0A= static int sit9531x_prg_relock_retry(struct sit9531x_dev *sitdev)=0A= {=0A= - int rc, lock_rc;=0A= + int rc;=0A= =0A= - rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_UNLOCK_VAL);=0A= - if (rc) {=0A= - lock_rc =3D sit9531x_write_close(sitdev,=0A= - SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_LOCK_VAL);=0A= - if (lock_rc)=0A= - dev_warn(sitdev->dev,=0A= - "output debug block left unlocked: %d\n",=0A= - lock_rc);=0A= + rc =3D sit9531x_outsys_debug_open(sitdev);=0A= + if (rc)=0A= return rc;=0A= - }=0A= =0A= return sit9531x_prg_relock(sitdev);=0A= }=0A= @@ -562,30 +594,21 @@ static int sit9531x_prg_commit(struct sit9531x_dev *s= itdev)=0A= }=0A= =0A= /*=0A= - * Unlock the Page 3 debug registers and enter PRG_CMD; output-system writ= es=0A= - * take effect only in this state.=0A= + * Open the Page 3 debug window and enter PRG_CMD; the output divider take= s=0A= + * effect only in this state.=0A= */=0A= static int sit9531x_prg_enter(struct sit9531x_dev *sitdev)=0A= {=0A= - int rc, lock_rc;=0A= + int rc;=0A= =0A= - rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_UNLOCK_VAL);=0A= - if (rc) {=0A= - lock_rc =3D sit9531x_write_close(sitdev,=0A= - SIT9531X_REG_OUTSYS_DEBUG,=0A= - SIT9531X_DEBUG_LOCK_VAL);=0A= - if (lock_rc)=0A= - dev_warn(sitdev->dev,=0A= - "output debug block left unlocked: %d\n",=0A= - lock_rc);=0A= + rc =3D sit9531x_outsys_debug_open(sitdev);=0A= + if (rc)=0A= return rc;=0A= - }=0A= =0A= rc =3D sit9531x_write_u8(sitdev, SIT9531X_REG_PRG_DIR_GEN,=0A= SIT9531X_PRG_CMD_STATE);=0A= if (rc) {=0A= - sit9531x_prg_abort(sitdev);=0A= + sit9531x_prg_relock(sitdev);=0A= return rc;=0A= }=0A= =0A= @@ -610,6 +633,159 @@ static int sit9531x_prg_retry(struct sit9531x_dev *si= tdev)=0A= return sit9531x_prg_commit(sitdev);=0A= }=0A= =0A= +/*=0A= + * Set one Hi-Z pair to @mask/@state from @cur_mask/@cur_state, writing on= ly the=0A= + * bits that differ. STATE goes first while the override stays on and last= when=0A= + * it goes off, so the pad holds no other value for one I2C transfer.=0A= + */=0A= +static int sit9531x_hiz_pair_put(struct sit9531x_dev *sitdev,=0A= + const struct sit9531x_hiz_pair *p, bool mask,=0A= + bool state, bool cur_mask, bool cur_state)=0A= +{=0A= + int rc =3D 0;=0A= +=0A= + if (mask && state !=3D cur_state)=0A= + rc =3D sit9531x_hiz_set_bit(sitdev, p->state, p->bit, state);=0A= + if (!rc && mask !=3D cur_mask)=0A= + rc =3D sit9531x_hiz_set_bit(sitdev, p->mask, p->bit, mask);=0A= + if (!rc && !mask && state !=3D cur_state)=0A= + rc =3D sit9531x_hiz_set_bit(sitdev, p->state, p->bit, state);=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/*=0A= + * Mute every Hi-Z pair of a slot, or unmute it: put back on each pair the= =0A= + * MASK and STATE bits in @out->hiz_mask and @out->hiz_state. The force=0A= + * registers are outside the NVM, so no directive is written, as in=0A= + * Output_Disable_Control_HiZ.py. Caller must hold the debug window open.= =0A= + */=0A= +static int sit9531x_output_hiz_write(struct sit9531x_dev *sitdev, u8 slot,= =0A= + bool mute, const struct sit9531x_out *out)=0A= +{=0A= + u8 mask[SIT9531X_HIZ_PAIRS], state[SIT9531X_HIZ_PAIRS];=0A= + struct sit9531x_hiz_pair p[SIT9531X_HIZ_PAIRS];=0A= + int i, rc, undo_rc;=0A= +=0A= + sit9531x_output_get_hiz_regs(slot, p);=0A= +=0A= + for (i =3D 0; i < SIT9531X_HIZ_PAIRS; i++) {=0A= + rc =3D sit9531x_read_u8(sitdev, p[i].state, &state[i]);=0A= + if (rc)=0A= + return rc;=0A= + rc =3D sit9531x_read_u8(sitdev, p[i].mask, &mask[i]);=0A= + if (rc)=0A= + return rc;=0A= + }=0A= +=0A= + for (i =3D 0; i < SIT9531X_HIZ_PAIRS; i++) {=0A= + bool cur_mask =3D mask[i] & BIT(p[i].bit);=0A= + bool cur_state =3D state[i] & BIT(p[i].bit);=0A= +=0A= + /* A mute writes both bits, whatever they hold */=0A= + if (mute)=0A= + rc =3D sit9531x_hiz_pair_put(sitdev, &p[i], true, false,=0A= + false, true);=0A= + else=0A= + rc =3D sit9531x_hiz_pair_put(sitdev, &p[i],=0A= + out->hiz_mask & BIT(i),=0A= + out->hiz_state & BIT(i),=0A= + cur_mask, cur_state);=0A= + if (rc)=0A= + break;=0A= + }=0A= + if (!rc)=0A= + return 0;=0A= +=0A= + /* Put back what the pairs held, both bits of each */=0A= + for (; i >=3D 0; i--) {=0A= + bool old_mask =3D mask[i] & BIT(p[i].bit);=0A= + bool old_state =3D state[i] & BIT(p[i].bit);=0A= +=0A= + undo_rc =3D sit9531x_hiz_pair_put(sitdev, &p[i], old_mask,=0A= + old_state, !old_mask,=0A= + !old_state);=0A= + if (undo_rc)=0A= + dev_err(sitdev->dev,=0A= + "slot%u: Hi-Z override left part applied (%d)\n",=0A= + slot, undo_rc);=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/* Caller must hold sitdev->multiop_lock. */=0A= +int sit9531x_output_disable(struct sit9531x_dev *sitdev, u8 index)=0A= +{=0A= + const struct sit9531x_chip_info *info =3D sitdev->info;=0A= + int rc, state_rc;=0A= + bool muted, part;=0A= + u8 slot;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (index >=3D info->num_outputs)=0A= + return -EINVAL;=0A= +=0A= + slot =3D info->clkout_map[index];=0A= + rc =3D sit9531x_outsys_debug_open(sitdev);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + rc =3D sit9531x_output_hiz_write(sitdev, slot, true, &sitdev->out[index])= ;=0A= + sit9531x_outsys_debug_close(sitdev);=0A= +=0A= + /* Read back the Hi-Z state */=0A= + state_rc =3D sit9531x_output_forced_hiz(sitdev, index, &muted, &part);=0A= + if (!state_rc) {=0A= + sitdev->out[index].enabled =3D !muted;=0A= + sitdev->out[index].part_muted =3D part;=0A= + sitdev->out[index].state_stale =3D false;=0A= + } else {=0A= + sitdev->out[index].state_stale =3D true;=0A= + if (!rc)=0A= + rc =3D state_rc;=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/* Caller must hold sitdev->multiop_lock. */=0A= +int sit9531x_output_enable(struct sit9531x_dev *sitdev, u8 index)=0A= +{=0A= + const struct sit9531x_chip_info *info =3D sitdev->info;=0A= + int rc, state_rc;=0A= + bool muted, part;=0A= + u8 slot;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (index >=3D info->num_outputs)=0A= + return -EINVAL;=0A= +=0A= + slot =3D info->clkout_map[index];=0A= + rc =3D sit9531x_outsys_debug_open(sitdev);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + rc =3D sit9531x_output_hiz_write(sitdev, slot, false,=0A= + &sitdev->out[index]);=0A= + sit9531x_outsys_debug_close(sitdev);=0A= +=0A= + state_rc =3D sit9531x_output_forced_hiz(sitdev, index, &muted, &part);=0A= + if (!state_rc) {=0A= + sitdev->out[index].enabled =3D !muted;=0A= + sitdev->out[index].part_muted =3D part;=0A= + sitdev->out[index].state_stale =3D false;=0A= + } else {=0A= + sitdev->out[index].state_stale =3D true;=0A= + if (!rc)=0A= + rc =3D state_rc;=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= /*=0A= * Procedure:=0A= * 1. Force PLL into holdover (PLL page reg 0x6F bit 4)=0A= @@ -2220,9 +2396,10 @@ static int sit9531x_chan_state_fetch(struct sit9531x= _dev *sitdev, u8 pll_idx)=0A= static int sit9531x_out_state_fetch(struct sit9531x_dev *sitdev, u8 index)= =0A= {=0A= struct sit9531x_out *out =3D &sitdev->out[index];=0A= + struct sit9531x_hiz_pair p[SIT9531X_HIZ_PAIRS];=0A= u8 map_lo, map_hi, slot, bit, claimed;=0A= bool muted, part;=0A= - int pll_idx;=0A= + int pll_idx, i;=0A= u16 mask;=0A= int rc;=0A= =0A= @@ -2232,11 +2409,37 @@ static int sit9531x_out_state_fetch(struct sit9531x= _dev *sitdev, u8 index)=0A= if (rc)=0A= return rc;=0A= =0A= + out->hiz_mask =3D 0;=0A= + out->hiz_state =3D 0;=0A= rc =3D sit9531x_output_forced_hiz(sitdev, index, &muted, &part);=0A= if (rc)=0A= return rc;=0A= =0A= - sitdev->out[index].part_muted =3D part;=0A= + /*=0A= + * Record what an unmute puts back on each Hi-Z pair: the MASK and STATE= =0A= + * bits found here. A pair forced to Hi-Z stays forced on a driven=0A= + * output and is released on a muted one, so that the unmute drives it.= =0A= + * The pad forced on a part-muted output is then the configuration's.=0A= + */=0A= + sit9531x_output_get_hiz_regs(slot, p);=0A= + for (i =3D 0; i < SIT9531X_HIZ_PAIRS; i++) {=0A= + u8 mask_val, state_val;=0A= +=0A= + rc =3D sit9531x_read_u8(sitdev, p[i].mask, &mask_val);=0A= + if (!rc)=0A= + rc =3D sit9531x_read_u8(sitdev, p[i].state, &state_val);=0A= + if (rc)=0A= + return rc;=0A= + if (state_val & BIT(p[i].bit))=0A= + out->hiz_state |=3D BIT(i);=0A= + else if (muted)=0A= + continue;=0A= + if (mask_val & BIT(p[i].bit))=0A= + out->hiz_mask |=3D BIT(i);=0A= + }=0A= +=0A= + sitdev->out[index].part_muted =3D false;=0A= + sitdev->out[index].state_stale =3D false;=0A= =0A= /*=0A= * Each PLL page holds a 12-bit output-enable mask: OUT_MAP_LO bits 0-7= =0A= @@ -2687,6 +2890,8 @@ sit9531x_dev_chan_states_update(struct sit9531x_dev *= sitdev)=0A= sit9531x_prg_retry(sitdev);=0A= if (bank && !sitdev->bank_pending)=0A= dev_info(sitdev->dev, "output divider bank updated\n");=0A= + } else if (sitdev->outsys_key_pending) {=0A= + sit9531x_outsys_debug_close(sitdev);=0A= }=0A= =0A= sit9531x_input_off_retry(sitdev);=0A= @@ -3043,6 +3248,8 @@ static void sit9531x_dev_stop(struct sit9531x_dev *si= tdev)=0A= if (sitdev->loops_open)=0A= dev_warn(sitdev->dev,=0A= "output loops left unlocked at removal\n");=0A= + } else if (sitdev->outsys_key_pending) {=0A= + sit9531x_outsys_debug_close(sitdev);=0A= }=0A= mutex_unlock(&sitdev->multiop_lock);=0A= }=0A= @@ -3120,7 +3327,7 @@ static void sit9531x_dpll_pin_unregister(struct sit95= 31x_dpll_pin *pin)=0A= * Clear before unregistering: callbacks test it under the DPLL device=0A= * lock, which dpll_pin_unregister() also takes.=0A= */=0A= - pin->dpll_pin =3D NULL;=0A= + WRITE_ONCE(pin->dpll_pin, NULL);=0A= =0A= dpll_pin_unregister(sitdpll->dpll_dev, dpll_pin, pin->ops, pin);=0A= dpll_pin_put(dpll_pin, &pin->tracker);=0A= @@ -3156,20 +3363,33 @@ static void sit9531x_dpll_pins_unregister(struct si= t9531x_dpll *sitdpll)=0A= }=0A= }=0A= =0A= -/* Check if the pin class has a state callback, which the DPLL core requir= es */=0A= +/*=0A= + * An output is registered when routed to this DPLL, whether or not it is= =0A= + * driving.=0A= + */=0A= static bool sit9531x_dpll_pin_is_registrable(struct sit9531x_dpll *sitdpll= ,=0A= enum dpll_pin_direction dir,=0A= u8 index)=0A= {=0A= struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= =0A= - if (dir !=3D DPLL_PIN_DIRECTION_INPUT)=0A= + if (dir =3D=3D DPLL_PIN_DIRECTION_INPUT) {=0A= + if (index =3D=3D SIT9531X_MAX_INPUTS)=0A= + return true;=0A= + if (index =3D=3D SIT9531X_INTSYNC_PIN_ID)=0A= + return false;=0A= +=0A= + return sit9531x_input_pin_is_registrable(sitdev, index);=0A= + }=0A= +=0A= + if (index =3D=3D SIT9531X_INTSYNC_OUT_PIN_ID)=0A= return false;=0A= =0A= - if (index =3D=3D SIT9531X_MAX_INPUTS)=0A= - return true;=0A= + if (index >=3D sitdev->info->num_outputs)=0A= + return false;=0A= =0A= - return sit9531x_input_pin_is_registrable(sitdev, index);=0A= + return sitdev->out[index].pll_idx =3D=3D sitdpll->id &&=0A= + sitdev->out[index].routed;=0A= }=0A= =0A= static int sit9531x_dpll_pins_register(struct sit9531x_dpll *sitdpll)=0A= @@ -3771,17 +3991,26 @@ static int sit9531x_resume(struct device *dev)=0A= sit9531x_ref_pll_mask_rebuild(sitdev);=0A= for (i =3D 0; i < sitdev->info->num_outputs; i++) {=0A= struct sit9531x_out *out =3D &sitdev->out[i];=0A= + u8 hiz_mask =3D out->hiz_mask, hiz_state =3D out->hiz_state;=0A= + bool enabled =3D out->enabled;=0A= bool routed =3D out->routed;=0A= u8 pll_idx =3D out->pll_idx;=0A= =0A= rc =3D sit9531x_out_state_fetch(sitdev, i);=0A= - if (rc)=0A= + /* A muted output keeps the Hi-Z record taken before the mute */=0A= + if (rc || (!enabled && !out->enabled)) {=0A= + out->hiz_mask =3D hiz_mask;=0A= + out->hiz_state =3D hiz_state;=0A= + }=0A= + if (rc) {=0A= dev_warn(sitdev->dev,=0A= "out%u: state not read on resume: %d\n",=0A= i, rc);=0A= + out->state_stale =3D true;=0A= + }=0A= if (out->routed !=3D routed || out->pll_idx !=3D pll_idx)=0A= dev_warn(sitdev->dev,=0A= - "out%u: routing changed over suspend\n",=0A= + "out%u: routing changed over suspend; its pin stays on the DPLL it wa= s registered on\n",=0A= i);=0A= }=0A= mutex_unlock(&sitdev->multiop_lock);=0A= diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h=0A= index e664a3d247e1..3c2a312f392c 100644=0A= --- a/drivers/dpll/sit9531x/core.h=0A= +++ b/drivers/dpll/sit9531x/core.h=0A= @@ -113,8 +113,18 @@ struct sit9531x_ref {=0A= * @freq: output frequency in Hz=0A= * @enabled: output is driving, not forced into Hi-Z=0A= * @cmos: single-ended; the CMOS pad Hi-Z pairs apply, not the differentia= l one=0A= - * @part_muted: single-ended with one pad forced and the other not; report= ed=0A= - * as driven=0A= + * @state_stale: cached mute state must be read back before it is reported= =0A= + * @ntf_pending: pin change not yet notified; the poll notifies once the s= tate=0A= + * is read=0A= + * @part_muted: single-ended with one pad forced and the other not, where= =0A= + * @hiz_mask and @hiz_state do not keep the forced pad forced; reported = as=0A= + * driven. The driver's mute forces both pads.=0A= + * @hiz_mask: bit per Hi-Z pair, the MASK bit an unmute writes back; read = at=0A= + * probe and on resume, unless the output is muted both before and after= =0A= + * the resume. On an output muted at that read, a pair forced to Hi-Z is= =0A= + * taken as the mute, also one an earlier binding set, and its bit is=0A= + * cleared, so that an unmute drives the pair=0A= + * @hiz_state: bit per Hi-Z pair, the STATE bit an unmute writes back=0A= * @routed: mapped to @pll_idx by the loaded configuration; an output=0A= * unrouted at probe has no pin=0A= * @pll_idx: PLL driving this output (0-3)=0A= @@ -123,7 +133,11 @@ struct sit9531x_out {=0A= u64 freq;=0A= bool enabled;=0A= bool cmos;=0A= + bool state_stale;=0A= + bool ntf_pending;=0A= bool part_muted;=0A= + u8 hiz_mask;=0A= + u8 hiz_state;=0A= bool routed;=0A= u8 pll_idx;=0A= };=0A= @@ -247,6 +261,7 @@ struct sit9531x_chan {=0A= * band; written under @multiop_lock=0A= * @loops_open: output loops not yet re-locked=0A= * @bank_pending: output divider bank update still to be issued=0A= + * @outsys_key_pending: output-system debug key not closed=0A= */=0A= struct sit9531x_dev {=0A= struct device *dev;=0A= @@ -280,6 +295,7 @@ struct sit9531x_dev {=0A= =0A= bool loops_open;=0A= bool bank_pending;=0A= + bool outsys_key_pending;=0A= };=0A= =0A= int sit9531x_read_u8(struct sit9531x_dev *sitdev, unsigned int reg,=0A= @@ -307,6 +323,11 @@ int sit9531x_input_prio_remove(struct sit9531x_dev *si= tdev, u8 pll_idx,=0A= int sit9531x_input_prio_add(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= u8 input_idx);=0A= =0A= +int sit9531x_output_disable(struct sit9531x_dev *sitdev, u8 index);=0A= +int sit9531x_output_enable(struct sit9531x_dev *sitdev, u8 index);=0A= +int sit9531x_output_state_refresh(struct sit9531x_dev *sitdev,=0A= + u8 out_idx);=0A= +=0A= int sit9531x_output_freq_set(struct sit9531x_dev *sitdev, u8 out_idx,=0A= u8 pll_idx, u64 frequency);=0A= int sit9531x_output_freq_get(struct sit9531x_dev *sitdev, u8 out_idx,=0A= diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c=0A= index 25bee483bb5a..b0403c0bc132 100644=0A= --- a/drivers/dpll/sit9531x/dpll.c=0A= +++ b/drivers/dpll/sit9531x/dpll.c=0A= @@ -187,8 +187,9 @@ const struct dpll_device_ops sit9531x_dpll_device_ops = =3D {=0A= * falls back to another listed source and leaves the selection naming the= lost=0A= * one. On manual input select, the selected input is CONNECTED: the one t= he=0A= * select register names, or the one the PLL last tracked when the select = pins=0A= - * or the indirect choice pick it; a state request is refused. The XO pin = is=0A= - * always CONNECTED and reports its priority read-only.=0A= + * or the indirect choice pick it; a state request is refused. An output i= s=0A= + * CONNECTED while driven and DISCONNECTED while muted; SELECTABLE is refu= sed.=0A= + * The XO pin is always CONNECTED and reports its priority read-only.=0A= */=0A= =0A= /* Caller must hold sitdev->multiop_lock. */=0A= @@ -665,7 +666,9 @@ sit9531x_dpll_output_pin_frequency_set(const struct dpl= l_pin *pin,=0A= rc =3D sit9531x_output_freq_set(sitdev, dpin->id, actual_pll,=0A= frequency);=0A= if (rc) {=0A= - if (!sit9531x_output_freq_get(sitdev, dpin->id, &hz))=0A= + if (sit9531x_output_freq_get(sitdev, dpin->id, &hz))=0A= + moved =3D true;=0A= + else=0A= moved |=3D hz !=3D was;=0A= }=0A= mutex_unlock(&sitdev->multiop_lock);=0A= @@ -676,8 +679,112 @@ sit9531x_dpll_output_pin_frequency_set(const struct d= pll_pin *pin,=0A= NL_SET_ERR_MSG(extack, "Output frequency set failed");=0A= /* The core notifies only a request that succeeded */=0A= dpll_pin =3D READ_ONCE(dpin->dpll_pin);=0A= - if (moved && dpll_pin)=0A= - __dpll_pin_change_ntf(dpll_pin);=0A= + if (moved && dpll_pin && __dpll_pin_change_ntf(dpll_pin)) {=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + sitdev->out[dpin->id].ntf_pending =3D true;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + }=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/*=0A= + * DISCONNECTED while the output is forced to Hi-Z, by a mute request or b= y the=0A= + * loaded profile.=0A= + */=0A= +static int=0A= +sit9531x_dpll_output_pin_state_on_dpll_get(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv,=0A= + enum dpll_pin_state *state,=0A= + struct netlink_ext_ack *extack)=0A= +{=0A= + struct sit9531x_dpll_pin *dpin =3D pin_priv;=0A= + struct sit9531x_dpll *sitdpll =3D dpll_priv;=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + const struct sit9531x_out *out;=0A= + int rc =3D 0;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + out =3D sit9531x_out_state_get(sitdev, dpin->id);=0A= + if (out->state_stale)=0A= + rc =3D sit9531x_output_state_refresh(sitdev, dpin->id);=0A= + if (!rc)=0A= + *state =3D out->enabled ? DPLL_PIN_STATE_CONNECTED=0A= + : DPLL_PIN_STATE_DISCONNECTED;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + if (rc)=0A= + NL_SET_ERR_MSG(extack,=0A= + "Output mute state could not be read back");=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +/*=0A= + * Force Hi-Z through the slot's Hi-Z force/state register pairs: differen= tial,=0A= + * CMOS OutP and CMOS OutN.=0A= + */=0A= +static int=0A= +sit9531x_dpll_output_pin_state_on_dpll_set(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv,=0A= + enum dpll_pin_state state,=0A= + struct netlink_ext_ack *extack)=0A= +{=0A= + bool enable =3D state =3D=3D DPLL_PIN_STATE_CONNECTED;=0A= + struct sit9531x_dpll_pin *dpin =3D pin_priv;=0A= + struct sit9531x_dpll *sitdpll =3D dpll_priv;=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + bool was_enabled, changed;=0A= + int rc;=0A= +=0A= + /* An output is routed explicitly, not a selection candidate */=0A= + if (!enable && state !=3D DPLL_PIN_STATE_DISCONNECTED)=0A= + return -EINVAL;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= +=0A= + /*=0A= + * Skip a request for the current state. One CMOS pad forced and the=0A= + * other not is neither state, unless the configuration forces that pad.= =0A= + */=0A= + if (!sit9531x_output_state_refresh(sitdev, dpin->id) &&=0A= + sitdev->out[dpin->id].enabled =3D=3D enable &&=0A= + !sitdev->out[dpin->id].part_muted) {=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + return 0;=0A= + }=0A= +=0A= + was_enabled =3D sitdev->out[dpin->id].enabled;=0A= +=0A= + if (enable)=0A= + rc =3D sit9531x_output_enable(sitdev, dpin->id);=0A= + else=0A= + rc =3D sit9531x_output_disable(sitdev, dpin->id);=0A= +=0A= + changed =3D sitdev->out[dpin->id].enabled !=3D was_enabled ||=0A= + sitdev->out[dpin->id].state_stale;=0A= +=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + if (rc) {=0A= + struct dpll_pin *dpll_pin;=0A= +=0A= + NL_SET_ERR_MSG(extack, "Failed to set output pin state");=0A= + /*=0A= + * The core notifies only a request that succeeded. Teardown=0A= + * clears dpll_pin without the core's lock, which is held here;=0A= + * read it once, as a set handle stays valid until this returns.=0A= + */=0A= + dpll_pin =3D READ_ONCE(dpin->dpll_pin);=0A= + if (changed && dpll_pin && __dpll_pin_change_ntf(dpll_pin)) {=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + sitdev->out[dpin->id].ntf_pending =3D true;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + }=0A= }=0A= =0A= return rc;=0A= @@ -687,6 +794,8 @@ static const struct dpll_pin_ops sit9531x_dpll_output_p= in_ops =3D {=0A= .direction_get =3D sit9531x_dpll_output_pin_direction_get,=0A= .frequency_get =3D sit9531x_dpll_output_pin_frequency_get,=0A= .frequency_set =3D sit9531x_dpll_output_pin_frequency_set,=0A= + .state_on_dpll_get =3D sit9531x_dpll_output_pin_state_on_dpll_get,=0A= + .state_on_dpll_set =3D sit9531x_dpll_output_pin_state_on_dpll_set,=0A= };=0A= =0A= const struct dpll_pin_ops *=0A= @@ -774,8 +883,33 @@ void sit9531x_dpll_pin_baseline(struct sit9531x_dpll_p= in *pin)=0A= }=0A= =0A= /*=0A= - * Notify a changed lock status, pin state or priority; called from=0A= - * sit9531x_dev_periodic_work().=0A= + * Re-read an output with a pending change notification; return true once = the=0A= + * read succeeds. Caller must hold sitdev->multiop_lock.=0A= + */=0A= +static bool=0A= +sit9531x_dpll_output_ntf_pending(struct sit9531x_dev *sitdev,=0A= + const struct sit9531x_dpll_pin *pin)=0A= +{=0A= + struct sit9531x_out *out;=0A= +=0A= + if (sit9531x_dpll_is_input_pin(pin) ||=0A= + pin->id >=3D sitdev->info->num_outputs)=0A= + return false;=0A= +=0A= + out =3D &sitdev->out[pin->id];=0A= + if (!out->ntf_pending)=0A= + return false;=0A= + if (out->state_stale && sit9531x_output_state_refresh(sitdev, pin->id))= =0A= + return false;=0A= +=0A= + out->ntf_pending =3D false;=0A= +=0A= + return true;=0A= +}=0A= +=0A= +/*=0A= + * Notify a changed lock status, pin state, operational state or priority = and=0A= + * retry a notification that failed; called from sit9531x_dev_periodic_wor= k().=0A= */=0A= void sit9531x_dpll_changes_check(struct sit9531x_dpll *sitdpll)=0A= {=0A= @@ -821,8 +955,11 @@ void sit9531x_dpll_changes_check(struct sit9531x_dpll = *sitdpll)=0A= continue;=0A= }=0A= =0A= - if (!sit9531x_dpll_is_selection_pin(pin))=0A= + if (!sit9531x_dpll_is_selection_pin(pin)) {=0A= + pin->ntf_pending |=3D=0A= + sit9531x_dpll_output_ntf_pending(sitdev, pin);=0A= continue;=0A= + }=0A= =0A= sit9531x_dpll_pin_snapshot(sitdpll, pin, &state, &operstate,=0A= &prio);=0A= -- =0A= 2.39.2 (Apple Git-143)=0A= =0A=