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=148.163.129.52 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796169173; b=I2Up3XdtYykKh6Lera7iX1nXmnDbzyOuspNeTPMlpXKRFCAjo8GDcWA3YsNsAE/UBIYy PsI/KvT6/qf8VcgqC6H+YYhEqWwVsw5Ns85U6JjM/LnlisEpryq8G4gGM0T6Vd+EME1Qr 1QIHx4dBZlFeCWUnExn60BDKqakyykv0Dwfh14RN11mOsXueKQnp1ELq7e7RXMIGRs8tD dpKOhRsZtt6j8cSSOkoj9kMuPv0DGL2eZXohS9xGYhzkAb0T32uKQOcXN7kALK70IBP6o +48KyqUBDRbjrfoWVEktbJ1PfxkgwY0MMiunN3JLKp48YgA/vKV57nRxrnr3FBPkXhg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796169173; 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=/3WwtHqylT8IIhoYSW54XHWZft2ihz0C4ITCY9fHaT8=; b=Ctsa1Z8oCpoK3AQmrVJ9fTUChXkBKE3VhuukJOFG9ew8huBljoooZof/hY/IQ5Zc2wSi SmqzeFGpQKM5lb8WkgphHgxMbmeC50WnGs64+WOmPZw2u9JjbjptcC0Eia4nbF/cVxoOJ Umto7LSA4Gxax+FIJh3qw4wvSVwIsfvRyV6dG8jP4Bt3XR1VqH2sWybksa7Zy+L1MSfyS 9ya7P6eh+W1HswSUePZE7xUNcZNu4mu0EGXDeTGGc63NP+kL4mfLq/QvJ1S4ExjJ/iTWa Vd4tMZxcNSGzbSEOnFU4LG1+Vv0Q3kS91X49L7wENe2eDsr2h9kR5bUEKqC34kUgadw== 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=T1Mnh226; dkim=pass header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=0LbcjKQs; arc=pass header.oldest-pass=0 smtp.remote-ip=148.163.129.52 Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) (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 4281A606A330; Tue, 1 Dec 2026 23:52:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4281A606A330 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=T1Mnh226; 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=0LbcjKQs 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=/3WwtHqylT8IIhoYSW54XHWZft2ihz0C4ITCY9fHaT8=; b=T1Mnh226FlKbIoGNZ8r2DeZ3EOYr2iKmTAyg5ElPCTNKtitlDiVobTKWC6bqITv/BAH5OAkyYkxG+SmEYMoT52engXQnOFQRHzoTL2XlkavYTC97lXvnCSupBCpsLsCThh3f6xyXurWf8oM8hdeBfqeuIK3xmkwSPKLwyqLP3s4PB6TrKJixRTl2dbKa3X0uykphTHtvGNs0HkBgbIoeMnGdvP4v/xgxFj2L4JiMDceKuKpKOJbOjXgx0pG4t+WFEMiJWfp7rEkfNyWy5srLQSK5uc87lbl0x18sXuBYAaCq/4SLO4WciJpnwYPUuilr3lJud4MbiQ9Ym7iAefh4TQ== X-Virus-Scanned: Proofpoint Essentials engine Received: from CY3PR05CU001.outbound.protection.outlook.com (mail-westcentralusazon11023134.outbound.protection.outlook.com [40.93.201.134]) (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 E3B35280070; Tue, 1 Dec 2026 23:52:49 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=og/sjtRYije02lxhimzT4gFApgFMuDmyakzOm2zW8RIl7HAuzxUI7eyLtcrYP7en1RhpRVzymJmosXhJePXOkBZyFSJHEg8pO+DzJ0wtl9A4njKg2D77+pT/S+7d4ccUC66eTT2X/P/FSRdGEIsBhp4miJsXDNkqH52xHJmWejRSoUWT3jgxrTEk+fE4XE7Bx4EiVGLtC7ef1wp7syyUHYKk7T5c5s+Qk/rX9n/WSlh3GAnfhYcPMCYLBJYZTB5scYwrWuCM5uvW+FluiybRLLceAp1I7w7uTwK0kiUCKC8PZ90mDHf8VjEuGlyoniD9x0Vdqha93ZF9ru2x278fhw== 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=/3WwtHqylT8IIhoYSW54XHWZft2ihz0C4ITCY9fHaT8=; b=OTpV813LevfedY0fthBRRStEfdCVz2JSAgMP45UlKzGfUFaK6NUzByi0T4W3+2V8P6b6J+F8DB3+DvEyOo9YmbRkEpnFcw+4nYJH1U6qC5/Pltf40AGlx6fQptQN+/w2ApPgWc8powd8cnUuU4LH1VanfDK1N1Wvzc8yHavosy5SVr9Wg1wxB2/6jSZ4kTNZIaYPE72lz0KTOjCsC2DZU8vwJPJQo9LrQh6FWq3/fBIacFOmUomePfAtfbxttUqMtontkuYErnRT2oVa3HVTfU0TACtqfxP2Jb6t8+fYUyOPzJlO+GELpnVcBNMAZ2JtlkIGjIC8lPS9J1jLpqHx9w== 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=/3WwtHqylT8IIhoYSW54XHWZft2ihz0C4ITCY9fHaT8=; b=0LbcjKQs6DtsbpHqRL39IuIxfPIhw6ZenaLLLO77LwSwlD2FbXz0xUiaCEk3/uUgY0WmFspnPuxM9Fn1aoLpt3LsjmOjGgyESFBOmFDQDtBkIO26V5WRiaf2XocymV7SWDimxfgknpxzBiVnc0ZH7IUkrqf9QGXa+4hP/Z+UZ+HxmdZbQtk66QBgtUE0ZnTyqVg4jilhHAkGVbnxbfaLHoae7WMz8snvACfmXgSBTo38DdCl2NI0zcFaJq/O77VMYqHY5k9gGHM4WAlT9cAdnsL27rck2AQ/9do6VezThgjqmAyfzweuuaZTmALOoCG6vKmZt3OJDi/qBYkqxTw8FA== 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:47 +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:47 +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 12/13] dpll: sit9531x: add support to get phase offset on the connected input Thread-Topic: [PATCH net-next v17 12/13] dpll: sit9531x: add support to get phase offset on the connected input Thread-Index: AQHdge75pMYnOqsKFk6HZAUnwzU7LA== Date: Tue, 1 Dec 2026 23:52:08 +0000 Message-ID: <20261201235202.97645-13-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: d2215dad-9aa5-45bf-71fa-08df500633aa 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|261022115727099003|261021123027099003|261021135927099003|261022113327099003|261021121427099003|261026140227099003|261022105027099003|261028144727099003|261102123227099003|261009223027099003|22082099003|18002099003|6133799003|3023799007; x-microsoft-antispam-message-info: MIFd16GblUGx8/kighNgx17x8ZgQpQRxtItLJz2RuezvI2pJlMgGI4hcNuKf2bqHFtHMSK2BhPqXT/2EW6SZePzEhGOlCAVFmOlUBNIO65JwK4xsRAAX0FPKTsa3zQKS7T13vsu19qP+0cOfvwmtONOp39IrScprW9TkuMRSVJwQnpYbDvh3NfmyUvr99XgCCaQERsmad2HSPuXRf6G/Mj5/NgHa5w/QNTaO1dKIKIeH4B1RvHMdyKO64kvzGcxn5qzsayo4D5dBn6Wbj2xUU72pP+MvL6ZlpwBmg2DCjXCx6020+GvK5do0s5tUV0uUligb9PGOWqQLvqZqNqXh2I40t1Dt7cihrOOFJUxSb+r6XsFbag0nvTXi8ALsLRyk3Mz/VRFHxVlTSY87io6oY/sq51C73BKAoDtZKHxhT3oGxzCjpWYe3JI9M3vuK1rg5S3rTSPrrN1QK7gXs2J2f2qISsmVhOleQMFwda69RApNcjOcc6POeE764O5xzHvyzgAez4aWqkupPoz2Pe6p10eRUt1eun+bebDdXHtBHwJdJ9/0cey2RSy3EiG43KMhV9hsaPRg2S6Y0mNIOsNcx31hzwA+uA814igI3JApO+RcWRt3USRwQYG7tOUSHYoR/Sma/uXSWVw3uEYw12B6+rli5ja2ZOu5FhlLkVyzLGnb+D8BL2NJjvNovBsgWlWg4KsLsBKPrK7wJ68bRS7r4DbH5EXocroXXeyttAjKaCI= 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)(261022115727099003)(261021123027099003)(261021135927099003)(261022113327099003)(261021121427099003)(261026140227099003)(261022105027099003)(261028144727099003)(261102123227099003)(261009223027099003)(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?AMeEydfIKLOdEZ83C6aL9q70Fu9ynx20nTSMr2hEwEGcIKyLj8H2c+aFn7?= =?iso-8859-1?Q?srn2fJHq6FeRCApqQaXLpQ7qAA6BPQ6T5uDUtQO01ahBi+/4WTREng0Fss?= =?iso-8859-1?Q?6eCLWKxAJT2B0q67tl1YEXW/lcreobeSErrEyZc0AJ1pwXB28RcQP6PtNV?= =?iso-8859-1?Q?WzC5AuZHSBw58fSkOGAEvnVlt3ILQL4BU8ZCUrGIN8AjwFPTh14plmEwht?= =?iso-8859-1?Q?2/vC9ERlBLYNTsCf1fYNgnBLb4hCby7R4zg7/g/QortkdSbTTg09/JZBzV?= =?iso-8859-1?Q?GFO060bPxpygGP8ks+67IqoOwh0PnldtwGD0WqfRlhsNU8otUHu+CaQsrM?= =?iso-8859-1?Q?oDbjbHG7GHqFvHvI95MygMxo7YHAjLmFfrO/Gd2z3L78FaNwSH1IAbZXOi?= =?iso-8859-1?Q?rZYVRUNbP4cEjzlbHxcbpwIW2uYU7N+N64q1iuFj7wUS9S437mvxLbidrq?= =?iso-8859-1?Q?8MWItEgPfmnegzaZ1I1gZStsNSZasbpUlC9DVPneZ3N0j6ZnF83UckZcc6?= =?iso-8859-1?Q?/+CyrqDjCXcFng8zBalGgajS68tWdsB77ni+REYNGfW6fa6u+qefezJzF2?= =?iso-8859-1?Q?F6HHxp9G+tfYp4Vww2dKmqSdjKTDCFQskkZDNTPFBPdL19xyYsnaQIBmjW?= =?iso-8859-1?Q?vFyo9ekGugHkf0UIUxOK/5z+Ytiei0t7zb+sg8WZ9hrKSSbSJ93puymylv?= =?iso-8859-1?Q?LwKG0Jg69KNEBXSwBjTCdd8BDnXTuy2C69f8K+7Ma1aBJacN3aSYrQWx8f?= =?iso-8859-1?Q?DlVxla4wcC9I89FmC6br99Xxa6w+TgPkUmar0/e+QGxk+WZUtfd0WpM0GI?= =?iso-8859-1?Q?Xa9L0F7rZ2r0yUxJSeH6mAUBkmXEjgT5NAKDMOrdT29DseEw5x9iMBlixP?= =?iso-8859-1?Q?yP2TAqr3k44fKmvubPbUQlFCnP2w8/YTp48FEVRwu0o/Tpxy3TY/uP5KAM?= =?iso-8859-1?Q?BMZLh0P6BsX8FUQQTVbXB4Y0yEn0SZVn2dtTrosiad9N+Ch5CMYxrBjOYA?= =?iso-8859-1?Q?khg/BoRjhIkvKJEBT6bHywrho02NiulweL3brUE89kziCjfmlyk3fEUSgJ?= =?iso-8859-1?Q?AbnVkYPocrwOlhMLoaEYkGKzUyDtzTvBc1YlkcCIU+PtVy9HWgkQXbFUOB?= =?iso-8859-1?Q?9xxIE5fjyVfpBe4jSX76+KVWccRWnIvO7qhWhA0D3gaq2fLpfGnsPCsewM?= =?iso-8859-1?Q?iFw0WmhWx/myVCZsQLzAzFYzQ0EitZ7o5yT6RE7kxbNVSZQRF2bgz2Onkr?= =?iso-8859-1?Q?cNidGIPmF77aDsgJYYtM7xCH8bujBvdvKv7Za5/MMcUOI3zpMkkImHeOFh?= =?iso-8859-1?Q?HYmWveJANtd200hkTQLOqFR/koy0L+xDbaq2NhLVnV2xi0zIBh572pwR29?= =?iso-8859-1?Q?6StGavup/ZmG50lnw6fZYp2iV+N/uWll4M7UHRH/dSCr36NieIVrnIAGAS?= =?iso-8859-1?Q?IsNtG+K0cn2hjHgmg1E8iaDdP34qo5o/N5I3o9ozNgisbPAlPJ89VHKzR8?= =?iso-8859-1?Q?r/JzMy3wXFD4LuBlHldkX3micfxdcS+ra21rl8n8gPhqIpG5/KHVLP1xS3?= =?iso-8859-1?Q?4piykinsWygT2HrBW1/jxkwMCQO+Dd9E2hj5GNWbom38PiRyg7GpFwAcaE?= =?iso-8859-1?Q?4e5YF/JuN2rF+ow7RFod9UcKl0EIFVGeMkZfN4Av2m9DgAv+esZP2fr7fO?= =?iso-8859-1?Q?y+LKyGCZ67q5ayWQmhDHCdux59pph3jzaqSD5zN9puVroXr9s2ccci47XV?= =?iso-8859-1?Q?WjEVTb9ISRw999oOT4ZtD/QBIFAqgFJPxHWAKDpa7OWLP9?= 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: ebCE0Y5jMsgsIqjIq0JHT4VoZAMybTmqPBj4QIKVGhwtcU83qi2F4JB9nu0L4fW+0k5it6Gb1bKmxX+19H/mD4ttwKbovD/72SuHL+wERNaU5PBIKaTP57mkLESRR45icYdMNK5M1b1MqLU7vJ/yv2iiB5x5oEXEAXMle8NmxzSrkak8hzdsXkgr9fdTaiPH+SJMqP8rROeeyoNm3lMY9vPfPUWykqfm9KU+8Ou4QUa20BTjeB1ljMuiPLUr5W8wJtWQ1+FyFADXLhbBjigRh2qYo9NxiWAKsgeN/DiSwBxiGRVNT34noSjtlasQ8Gfrd29BvNopmwrwr0vKu8dUlg== 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: d2215dad-9aa5-45bf-71fa-08df500633aa X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2026 23:52:08.6881 (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: 4awrEQWWYMj7+qpVcq86Siuurl8kkBdM9TCMWODA/YnIQa20qwUFdTB/F8bsjqM9Iu8hoavhfgBG8IPnM3upEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR20MB6330 X-MDID: 1796169170-PEwJ_Y1vSoNY X-PPE-STACK: {"stack":"us1"} X-MDID-O: us1;ut7;1796169170;PEwJ_Y1vSoNY;;ba04557de9d2da8490f5f1e6de07b967 X-PPE-TRUSTED: V=1;DIR=OUT; From: Oleg Zadorozhnyi =0A= =0A= Report the phase difference between a PLL's reference and the PLL, read=0A= from the on-chip time-to-digital converter through the debug window as=0A= the documented procedure does. A read latches a sample and returns the=0A= previous one, so each sample is read three times. The sign bit is set=0A= when the reference edge comes first: a negative offset.=0A= =0A= The offset is sampled when the core builds a pin message, including the=0A= poll's change notifications, not on every tick: a sample is several=0A= dozen transfers per PLL. A sample that cannot be taken, on a bus error=0A= or with the output loops open, is an absent attribute.=0A= =0A= Only the input the part feeds the PLL has an offset. Any other pin, a=0A= PLL without a reference, a PLL that drives no enabled output or whose=0A= Fref * DIVN is outside its VCO band returns -ENODATA and the core leaves=0A= the attribute out. The XO pin has none: it is the frequency base of=0A= every PLL.=0A= =0A= The debug taps moved for a sample are put back after it; a restore that=0A= fails is retried by the poll, at removal and on the probe failure path,=0A= which now runs the same retries as 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 | 353 +++++++++++++++++++++++++++++------=0A= drivers/dpll/sit9531x/core.h | 12 ++=0A= drivers/dpll/sit9531x/dpll.c | 110 +++++++++++=0A= drivers/dpll/sit9531x/regs.h | 19 ++=0A= 4 files changed, 436 insertions(+), 58 deletions(-)=0A= =0A= diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c=0A= index 96d317c9bf37..1f4ed3365ffe 100644=0A= --- a/drivers/dpll/sit9531x/core.c=0A= +++ b/drivers/dpll/sit9531x/core.c=0A= @@ -263,6 +263,28 @@ static int sit9531x_update_pll_close(struct sit9531x_d= ev *sitdev, u8 pll_idx,=0A= return rc;=0A= }=0A= =0A= +/*=0A= + * Restore the debug taps a phase-offset read changed. The PLL page's debu= g=0A= + * window must already be open.=0A= + */=0A= +static int sit9531x_tap_restore(struct sit9531x_dev *sitdev, u8 pll_idx)= =0A= +{=0A= + struct sit9531x_chan *chan =3D &sitdev->chan[pll_idx];=0A= + int rc;=0A= +=0A= + rc =3D sit9531x_write_pll_close(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_READ_CODE,=0A= + chan->tap_read_code);=0A= + if (!rc)=0A= + rc =3D sit9531x_write_pll_close(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_WRITE_CODE,=0A= + chan->tap_write_code);=0A= + if (!rc)=0A= + chan->tap_pending =3D false;=0A= +=0A= + return rc;=0A= +}=0A= +=0A= static void sit9531x_input_get_regs(const struct sit9531x_dev *sitdev,=0A= u8 index,=0A= unsigned int *force_reg,=0A= @@ -860,12 +882,16 @@ static int sit9531x_prio_prg_commit(struct sit9531x_d= ev *sitdev)=0A= return 0;=0A= }=0A= =0A= -/*=0A= - * Four registers carry a nibble per lane: loss of signal and the fine and= =0A= - * coarse frequency-drift flags. Caller must hold sitdev->multiop_lock, or= run=0A= - * before registration.=0A= +/**=0A= + * sit9531x_input_mon_fetch - read the clock monitor status of every lane= =0A= + * @sitdev: device pointer=0A= + *=0A= + * One nibble per lane: loss of signal, fine and coarse frequency drift.= =0A= + * Caller must hold sitdev->multiop_lock, or run before registration.=0A= + *=0A= + * Return: 0 on success, <0 on error=0A= */=0A= -static int sit9531x_input_mon_fetch(struct sit9531x_dev *sitdev)=0A= +int sit9531x_input_mon_fetch(struct sit9531x_dev *sitdev)=0A= {=0A= static const unsigned int regs[] =3D {=0A= SIT9531X_CLKMON_P_STATUS_01, SIT9531X_CLKMON_P_STATUS_23,=0A= @@ -2734,6 +2760,176 @@ static int sit9531x_clear_notifications(struct sit9= 531x_dev *sitdev,=0A= return 0;=0A= }=0A= =0A= +/**=0A= + * sit9531x_phase_offset_read - read phase difference via TDC=0A= + * @sitdev: device pointer=0A= + * @pll_idx: PLL index (0-3)=0A= + * @phase_offset: phase difference in 1/DPLL_PHASE_OFFSET_DIVIDER ps=0A= + *=0A= + * The TDC code is a 35-bit magnitude with a separate sign bit;=0A= + * phase_diff =3D tdc_code / fvco. The result is negative when the referen= ce=0A= + * edge is the earlier one. Caller must hold sitdev->multiop_lock.=0A= + *=0A= + * Return: 0 on success, -ENODATA if Fvco is unknown, <0 on other errors= =0A= + */=0A= +int sit9531x_phase_offset_read(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + s64 *phase_offset)=0A= +{=0A= + u8 v, old_write_code, old_read_code;=0A= + struct sit9531x_chan *chan;=0A= + bool have_old =3D false;=0A= + int rc, ret, i;=0A= + s64 tdc_signed;=0A= + u64 fvco, mag;=0A= + u64 tdc_raw;=0A= + bool sign;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (pll_idx >=3D SIT9531X_NUM_PLLS)=0A= + return -EINVAL;=0A= + chan =3D &sitdev->chan[pll_idx];=0A= +=0A= + /*=0A= + * Read Fvco first; without it there is no reason to open the debug=0A= + * window.=0A= + */=0A= + rc =3D sit9531x_get_fvco(sitdev, pll_idx, &fvco);=0A= + if (rc) {=0A= + if (rc =3D=3D -ENODATA)=0A= + dev_dbg(sitdev->dev,=0A= + "PLL%c: Fvco unknown, skip TDC\n",=0A= + 'A' + pll_idx);=0A= + return rc;=0A= + }=0A= +=0A= + rc =3D sit9531x_write_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DEBUG,=0A= + SIT9531X_PLL_DEBUG_UNLOCK);=0A= + if (rc)=0A= + goto relock;=0A= +=0A= + /* Restore pending taps before saving the selection */=0A= + if (chan->tap_pending) {=0A= + rc =3D sit9531x_tap_restore(sitdev, pll_idx);=0A= + if (rc)=0A= + goto relock;=0A= + }=0A= +=0A= + /* Save the tap selection; the debug key does not cover the mux. */=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_WRITE_CODE,=0A= + &old_write_code);=0A= + if (!rc)=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_READ_CODE,=0A= + &old_read_code);=0A= + if (rc)=0A= + goto relock;=0A= +=0A= + have_old =3D true;=0A= +=0A= + /*=0A= + * Enable the debug clock for taps below 200 kHz, then select the TDC=0A= + * tap. The modifier register also holds fields of other taps.=0A= + */=0A= + rc =3D sit9531x_update_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_WRITE_CODE,=0A= + SIT9531X_DBG_LOW_FREQ_CLK_BIT,=0A= + SIT9531X_DBG_LOW_FREQ_CLK_BIT);=0A= + if (rc)=0A= + goto relock;=0A= + rc =3D sit9531x_write_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_READ_CODE,=0A= + SIT9531X_DBG_READ_CODE_TDC);=0A= + if (rc)=0A= + goto relock;=0A= +=0A= + /*=0A= + * A status data read latches a sample and returns the previous one;=0A= + * read three times as the documented procedure does. The procedure=0A= + * leaves the status address unwritten.=0A= + */=0A= + for (i =3D 0; i < SIT9531X_DBG_STATUS_READS; i++) {=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_STATUS_DATA,=0A= + &v);=0A= + if (rc)=0A= + goto relock;=0A= + }=0A= +=0A= + tdc_raw =3D 0;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_DATA_4, &v);=0A= + if (rc)=0A= + goto relock;=0A= + sign =3D !!(v & BIT(SIT9531X_TDC_SIGN_BIT));=0A= + tdc_raw =3D (u64)(v & SIT9531X_TDC_MAG_HI_MASK) << 32;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_DATA_3, &v);=0A= + if (rc)=0A= + goto relock;=0A= + tdc_raw |=3D (u64)v << 24;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_DATA_2, &v);=0A= + if (rc)=0A= + goto relock;=0A= + tdc_raw |=3D (u64)v << 16;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_DATA_1, &v);=0A= + if (rc)=0A= + goto relock;=0A= + tdc_raw |=3D (u64)v << 8;=0A= +=0A= + rc =3D sit9531x_read_pll_u8(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DBG_DATA_0, &v);=0A= + if (rc)=0A= + goto relock;=0A= + tdc_raw |=3D v;=0A= +=0A= + /*=0A= + * The sign bit is set when the reference edge comes first; the=0A= + * subsystem reports a pin that is earlier than the DPLL as negative.=0A= + */=0A= + tdc_signed =3D sign ? -(s64)tdc_raw : (s64)tdc_raw;=0A= +=0A= + /*=0A= + * phase_diff (ps) =3D tdc_code * 1e12 / fvco. Scale by the subsystem's= =0A= + * divider before dividing to keep the fractional digits; one code is=0A= + * 203.45 ps at 4.9152 GHz.=0A= + */=0A= + mag =3D mul_u64_u64_div_u64(tdc_signed < 0 ? -tdc_signed : tdc_signed,=0A= + 1000000000000ULL * DPLL_PHASE_OFFSET_DIVIDER,=0A= + fvco);=0A= + *phase_offset =3D tdc_signed < 0 ? -(s64)mag : (s64)mag;=0A= +=0A= + rc =3D 0;=0A= +=0A= +relock:=0A= + if (have_old) {=0A= + chan->tap_read_code =3D old_read_code;=0A= + chan->tap_write_code =3D old_write_code;=0A= + ret =3D sit9531x_tap_restore(sitdev, pll_idx);=0A= + if (ret)=0A= + chan->tap_pending =3D true;=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= + }=0A= +=0A= + ret =3D sit9531x_write_pll_close(sitdev, pll_idx,=0A= + SIT9531X_PLL_REG_DEBUG,=0A= + SIT9531X_PLL_DEBUG_LOCK);=0A= + chan->key_pending =3D !!ret;=0A= + if (ret && !rc)=0A= + rc =3D ret;=0A= +=0A= + return rc;=0A= +}=0A= +=0A= /* Read the lane's receiver state from the Page 0x02 force and state bits = */=0A= static int sit9531x_ref_state_fetch(struct sit9531x_dev *sitdev, u8 index)= =0A= {=0A= @@ -2877,13 +3073,21 @@ static int sit9531x_chan_select_fetch(struct sit953= 1x_dev *sitdev, u8 pll_idx)=0A= return 0;=0A= }=0A= =0A= -/*=0A= - * Read the reference the device feeds a PLL from the debug status bus; th= e=0A= - * active selection does not change on a fallback. The caller rules out fr= ee-run=0A= - * first and must hold sitdev->multiop_lock.=0A= +/**=0A= + * sit9531x_chan_routed_ref_read - read the reference the device feeds a P= LL=0A= + * @sitdev: device pointer=0A= + * @pll_idx: PLL index (0-3)=0A= + * @ref: logical input index, SIT9531X_MAX_INPUTS for the XO,=0A= + * SIT9531X_INTSYNC_PIN_ID, or SIT9531X_REF_INVALID=0A= + *=0A= + * The device falls back between listed sources without changing the activ= e=0A= + * selection, so read the source from the debug status bus. The caller rul= es=0A= + * out free-run first and must hold multiop_lock.=0A= + *=0A= + * Return: 0 on success, <0 on error=0A= */=0A= -static int sit9531x_chan_routed_ref_read(struct sit9531x_dev *sitdev,=0A= - u8 pll_idx, u8 *ref)=0A= +int sit9531x_chan_routed_ref_read(struct sit9531x_dev *sitdev, u8 pll_idx,= =0A= + u8 *ref)=0A= {=0A= int rc, lock_rc;=0A= u8 v, i;=0A= @@ -3448,14 +3652,22 @@ static void sit9531x_table_back_retry(struct sit953= 1x_dev *sitdev, u8 pll_idx)=0A= 'A' + pll_idx);=0A= }=0A= =0A= -/* Lock the PLL debug key again. Caller must hold sitdev->multiop_lock. */= =0A= +/*=0A= + * Restore the debug taps and lock the PLL debug key again. Caller must ho= ld=0A= + * sitdev->multiop_lock.=0A= + */=0A= static void sit9531x_debug_back_retry(struct sit9531x_dev *sitdev, u8 pll_= idx)=0A= {=0A= struct sit9531x_chan *chan =3D &sitdev->chan[pll_idx];=0A= =0A= - if (!chan->key_pending)=0A= + if (!chan->tap_pending && !chan->key_pending)=0A= return;=0A= =0A= + if (chan->tap_pending &&=0A= + !sit9531x_write_pll_u8(sitdev, pll_idx, SIT9531X_PLL_REG_DEBUG,=0A= + SIT9531X_PLL_DEBUG_UNLOCK))=0A= + sit9531x_tap_restore(sitdev, pll_idx);=0A= +=0A= chan->key_pending =3D !!sit9531x_write_pll_close(sitdev, pll_idx,=0A= SIT9531X_PLL_REG_DEBUG,=0A= SIT9531X_PLL_DEBUG_LOCK);=0A= @@ -3859,55 +4071,30 @@ static void sit9531x_pin_nodes_check(struct sit9531= x_dev *sitdev)=0A= fwnode_handle_put(pins);=0A= }=0A= =0A= -static int sit9531x_dev_start(struct sit9531x_dev *sitdev)=0A= +/* Retry the pending debug tap restore and debug window close */=0A= +static void sit9531x_tap_pending_retry(struct sit9531x_dev *sitdev)=0A= {=0A= - struct sit9531x_dpll *sitdpll;=0A= - int rc;=0A= -=0A= - rc =3D sit9531x_dev_state_fetch(sitdev);=0A= - if (rc)=0A= - return rc;=0A= + u8 i;=0A= =0A= mutex_lock(&sitdev->multiop_lock);=0A= - sit9531x_eeprom_state_report(sitdev);=0A= - sit9531x_pll_states_report(sitdev);=0A= - mutex_unlock(&sitdev->multiop_lock);=0A= -=0A= - sit9531x_pin_nodes_check(sitdev);=0A= -=0A= - list_for_each_entry(sitdpll, &sitdev->dplls, list) {=0A= - rc =3D sit9531x_dpll_register(sitdpll);=0A= - if (rc) {=0A= - rc =3D dev_err_probe(sitdev->dev, rc,=0A= - "Failed to register DPLL%u\n",=0A= - sitdpll->id);=0A= - goto err_unregister;=0A= - }=0A= + for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= + sit9531x_debug_back_retry(sitdev, i);=0A= + if (sitdev->chan[i].tap_pending || sitdev->chan[i].key_pending)=0A= + dev_warn(sitdev->dev,=0A= + "PLL%c left with its debug taps moved or window open\n",=0A= + 'A' + i);=0A= }=0A= -=0A= - kthread_queue_delayed_work(sitdev->kworker, &sitdev->work, 0);=0A= -=0A= - return 0;=0A= -=0A= -err_unregister:=0A= - list_for_each_entry_continue_reverse(sitdpll, &sitdev->dplls, list)=0A= - sit9531x_dpll_unregister(sitdpll);=0A= -=0A= - return rc;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= }=0A= =0A= -static void sit9531x_dev_stop(struct sit9531x_dev *sitdev)=0A= +/*=0A= + * Retry every pending write once more and report what is still pending. C= all=0A= + * with the DPLLs unregistered.=0A= + */=0A= +static void sit9531x_dev_pending_retry(struct sit9531x_dev *sitdev)=0A= {=0A= - struct sit9531x_dpll *sitdpll;=0A= u8 i;=0A= =0A= - kthread_cancel_delayed_work_sync(&sitdev->work);=0A= -=0A= - list_for_each_entry(sitdpll, &sitdev->dplls, list) {=0A= - if (sitdpll->dpll_dev)=0A= - sit9531x_dpll_unregister(sitdpll);=0A= - }=0A= -=0A= /*=0A= * Write back tables first: forced holdover stays set while a table=0A= * write-back is pending.=0A= @@ -3929,11 +4116,6 @@ static void sit9531x_dev_stop(struct sit9531x_dev *s= itdev)=0A= !sitdev->chan[i].table_pending)=0A= dev_warn(sitdev->dev,=0A= "PLL%c left in forced holdover\n", 'A' + i);=0A= - sit9531x_debug_back_retry(sitdev, i);=0A= - if (sitdev->chan[i].key_pending)=0A= - dev_warn(sitdev->dev,=0A= - "PLL%c left with its debug window open\n",=0A= - 'A' + i);=0A= }=0A= =0A= /* After the table write-back: the tables give the receiver claims */=0A= @@ -3990,6 +4172,61 @@ static void sit9531x_dev_stop(struct sit9531x_dev *s= itdev)=0A= (sitdev->flush_armed & BIT(i)) ? "parked" : "armed");=0A= }=0A= mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + sit9531x_tap_pending_retry(sitdev);=0A= +}=0A= +=0A= +static int sit9531x_dev_start(struct sit9531x_dev *sitdev)=0A= +{=0A= + struct sit9531x_dpll *sitdpll;=0A= + int rc;=0A= +=0A= + rc =3D sit9531x_dev_state_fetch(sitdev);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + sit9531x_eeprom_state_report(sitdev);=0A= + sit9531x_pll_states_report(sitdev);=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + sit9531x_pin_nodes_check(sitdev);=0A= +=0A= + list_for_each_entry(sitdpll, &sitdev->dplls, list) {=0A= + rc =3D sit9531x_dpll_register(sitdpll);=0A= + if (rc) {=0A= + rc =3D dev_err_probe(sitdev->dev, rc,=0A= + "Failed to register DPLL%u\n",=0A= + sitdpll->id);=0A= + goto err_unregister;=0A= + }=0A= + }=0A= +=0A= + kthread_queue_delayed_work(sitdev->kworker, &sitdev->work, 0);=0A= +=0A= + return 0;=0A= +=0A= +err_unregister:=0A= + list_for_each_entry_continue_reverse(sitdpll, &sitdev->dplls, list)=0A= + sit9531x_dpll_unregister(sitdpll);=0A= +=0A= + sit9531x_dev_pending_retry(sitdev);=0A= +=0A= + return rc;=0A= +}=0A= +=0A= +static void sit9531x_dev_stop(struct sit9531x_dev *sitdev)=0A= +{=0A= + struct sit9531x_dpll *sitdpll;=0A= +=0A= + kthread_cancel_delayed_work_sync(&sitdev->work);=0A= +=0A= + list_for_each_entry(sitdpll, &sitdev->dplls, list) {=0A= + if (sitdpll->dpll_dev)=0A= + sit9531x_dpll_unregister(sitdpll);=0A= + }=0A= +=0A= + sit9531x_dev_pending_retry(sitdev);=0A= }=0A= =0A= static struct sit9531x_dpll_pin *=0A= diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h=0A= index 562c63ee117d..933789c1aa1c 100644=0A= --- a/drivers/dpll/sit9531x/core.h=0A= +++ b/drivers/dpll/sit9531x/core.h=0A= @@ -206,6 +206,9 @@ struct sit9531x_out {=0A= * stays in forced holdover=0A= * @table_back: table reported and to be rewritten while @table_pending=0A= * @key_pending: debug key of the PLL page not locked again=0A= + * @tap_pending: debug taps not restored after a phase-offset read=0A= + * @tap_write_code: tap selection to restore while @tap_pending=0A= + * @tap_read_code: readback selection to restore while @tap_pending=0A= * @prio_srcs: cached priority table, a source code per slot=0A= * @prio_last: first slot of each source plus one, 0 if absent=0A= * @prio_mask: bit per canonical source in the priority table read back=0A= @@ -244,6 +247,9 @@ struct sit9531x_chan {=0A= bool table_pending;=0A= u8 table_back[SIT9531X_PRIO_MAX_SLOTS];=0A= bool key_pending;=0A= + bool tap_pending;=0A= + u8 tap_write_code;=0A= + u8 tap_read_code;=0A= u8 prio_srcs[SIT9531X_PRIO_MAX_SLOTS];=0A= u8 prio_last[SIT9531X_PRIO_NUM_SRC];=0A= u16 prio_mask;=0A= @@ -368,6 +374,12 @@ int sit9531x_output_phase_read(struct sit9531x_dev *si= tdev, u8 out_idx,=0A= int sit9531x_output_phase_adjust_set(struct sit9531x_dev *sitdev,=0A= u8 out_idx, s32 phase_ps);=0A= =0A= +int sit9531x_chan_routed_ref_read(struct sit9531x_dev *sitdev, u8 pll_idx,= =0A= + u8 *ref);=0A= +int sit9531x_input_mon_fetch(struct sit9531x_dev *sitdev);=0A= +int sit9531x_phase_offset_read(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + s64 *phase_offset);=0A= +=0A= static inline u8 sit9531x_pll_page(u8 pll_idx)=0A= {=0A= return SIT9531X_PAGE_PLLA + pll_idx;=0A= diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c=0A= index 502b25f22be4..3fe65e2d5aec 100644=0A= --- a/drivers/dpll/sit9531x/dpll.c=0A= +++ b/drivers/dpll/sit9531x/dpll.c=0A= @@ -514,6 +514,112 @@ sit9531x_dpll_input_pin_prio_set(const struct dpll_pi= n *pin, void *pin_priv,=0A= return 0;=0A= }=0A= =0A= +/*=0A= + * Report the loop's residual phase error, sampled with the loop closed. T= he TDC=0A= + * compares against a signal the PLL drives, so a PLL driving no output re= turns=0A= + * -ENODATA.=0A= + */=0A= +static int=0A= +sit9531x_dpll_input_pin_phase_offset_get(const struct dpll_pin *pin,=0A= + void *pin_priv,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, s64 *phase_offset,=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= + bool drives =3D false;=0A= + u8 routed, i;=0A= + s64 offset;=0A= + int rc;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= +=0A= + /*=0A= + * Check the cache first: the core calls this for every pin of every=0A= + * DPLL in a dump. Output loops left open by a failed programming=0A= + * sequence give no closed-loop sample.=0A= + */=0A= + rc =3D -ENODATA;=0A= + if (sitdev->loops_open ||=0A= + !sit9531x_dpll_selection_active(sitdev, sitdpll, dpin->id))=0A= + goto out;=0A= +=0A= + /*=0A= + * The device can change the routed reference, so read it before and=0A= + * after the sample. A PLL with no routed, enabled output has no=0A= + * measurement.=0A= + */=0A= + for (i =3D 0; i < sitdev->info->num_outputs; i++) {=0A= + if (!sitdev->out[i].routed ||=0A= + sitdev->out[i].pll_idx !=3D sitdpll->id)=0A= + continue;=0A= + if (sitdev->out[i].state_stale) {=0A= + rc =3D sit9531x_output_state_refresh(sitdev, i);=0A= + if (rc)=0A= + goto out;=0A= + }=0A= + if (sitdev->out[i].enabled)=0A= + drives =3D true;=0A= + }=0A= + rc =3D -ENODATA;=0A= + if (!drives)=0A= + goto out;=0A= +=0A= + /*=0A= + * Read the monitors live: on loss of signal the device falls back=0A= + * without a request.=0A= + */=0A= + rc =3D sit9531x_input_mon_fetch(sitdev);=0A= + if (rc)=0A= + goto out;=0A= + if (!sit9531x_dpll_selection_active(sitdev, sitdpll, dpin->id)) {=0A= + rc =3D -ENODATA;=0A= + goto out;=0A= + }=0A= +=0A= + rc =3D sit9531x_chan_routed_ref_read(sitdev, sitdpll->id, &routed);=0A= + if (!rc && routed =3D=3D dpin->id) {=0A= + rc =3D sit9531x_phase_offset_read(sitdev, sitdpll->id, &offset);=0A= + if (!rc)=0A= + rc =3D sit9531x_chan_routed_ref_read(sitdev, sitdpll->id,=0A= + &routed);=0A= + if (!rc && routed !=3D dpin->id)=0A= + rc =3D -ENODATA;=0A= + } else if (!rc) {=0A= + rc =3D -ENODATA;=0A= + }=0A= + /*=0A= + * A reference lost during the sample can leave the routed reference=0A= + * unchanged while the PLL is in holdover; read the monitors again.=0A= + */=0A= + if (!rc) {=0A= + rc =3D sit9531x_input_mon_fetch(sitdev);=0A= + if (!rc && dpin->id < sitdev->info->num_inputs &&=0A= + sit9531x_ref_state_get(sitdev, dpin->id)->los)=0A= + rc =3D -ENODATA;=0A= + }=0A= +out:=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + /*=0A= + * A sample that could not be taken is an absent attribute; any other=0A= + * error from here fails the whole pin dump in the core.=0A= + */=0A= + if (rc && rc !=3D -ENODATA) {=0A= + dev_warn_ratelimited(sitdev->dev,=0A= + "PLL%c: phase offset not sampled: %d\n",=0A= + 'A' + sitdpll->id, rc);=0A= + return -ENODATA;=0A= + }=0A= + if (rc)=0A= + return rc;=0A= +=0A= + *phase_offset =3D offset;=0A= + return 0;=0A= +}=0A= +=0A= static const struct dpll_pin_ops sit9531x_dpll_input_pin_ops =3D {=0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= .frequency_get =3D sit9531x_dpll_input_pin_frequency_get,=0A= @@ -522,6 +628,7 @@ static const struct dpll_pin_ops sit9531x_dpll_input_pi= n_ops =3D {=0A= .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= .prio_get =3D sit9531x_dpll_input_pin_prio_get,=0A= .prio_set =3D sit9531x_dpll_input_pin_prio_set,=0A= + .phase_offset_get =3D sit9531x_dpll_input_pin_phase_offset_get,=0A= };=0A= =0A= /*=0A= @@ -535,6 +642,7 @@ static const struct dpll_pin_ops sit9531x_dpll_input_pi= n_norate_ops =3D {=0A= .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= .prio_get =3D sit9531x_dpll_input_pin_prio_get,=0A= .prio_set =3D sit9531x_dpll_input_pin_prio_set,=0A= + .phase_offset_get =3D sit9531x_dpll_input_pin_phase_offset_get,=0A= };=0A= =0A= /*=0A= @@ -558,6 +666,7 @@ static const struct dpll_pin_ops sit9531x_dpll_input_pi= n_manual_ops =3D {=0A= .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= .state_on_dpll_set =3D sit9531x_dpll_manual_pin_state_on_dpll_set,=0A= .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= + .phase_offset_get =3D sit9531x_dpll_input_pin_phase_offset_get,=0A= };=0A= =0A= static const struct dpll_pin_ops sit9531x_dpll_input_pin_norate_manual_ops= =3D {=0A= @@ -565,6 +674,7 @@ static const struct dpll_pin_ops sit9531x_dpll_input_pi= n_norate_manual_ops =3D {=0A= .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= .state_on_dpll_set =3D sit9531x_dpll_manual_pin_state_on_dpll_set,=0A= .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= + .phase_offset_get =3D sit9531x_dpll_input_pin_phase_offset_get,=0A= };=0A= =0A= /*=0A= diff --git a/drivers/dpll/sit9531x/regs.h b/drivers/dpll/sit9531x/regs.h=0A= index bd034abdf875..5d104b39bc4f 100644=0A= --- a/drivers/dpll/sit9531x/regs.h=0A= +++ b/drivers/dpll/sit9531x/regs.h=0A= @@ -222,6 +222,25 @@=0A= #define SIT9531X_PLL_REG_DIVN_NUM 0x32 /* 4 bytes (0x32-0x35) */=0A= #define SIT9531X_PLL_REG_DIVN_DEN 0x38 /* 4 bytes (0x38-0x3B) */=0A= =0A= +/*=0A= + * Signal pathway debug readback: Dig_Sys_ReadCode selects the tap,=0A= + * Dig_Sys_WriteCode its modifiers; a read of the debug status data regist= er=0A= + * latches a sample into Dig_Sys_read7..read0.=0A= + */=0A= +#define SIT9531X_PLL_REG_DBG_READ_CODE 0xB3=0A= +#define SIT9531X_PLL_REG_DBG_WRITE_CODE 0xB4=0A= +#define SIT9531X_DBG_LOW_FREQ_CLK_BIT BIT(7)=0A= +#define SIT9531X_PLL_REG_DBG_DATA_0 0xB5 /* [7:0] */=0A= +#define SIT9531X_PLL_REG_DBG_DATA_1 0xB6 /* [15:8] */=0A= +#define SIT9531X_PLL_REG_DBG_DATA_2 0xB7 /* [23:16] */=0A= +#define SIT9531X_PLL_REG_DBG_DATA_3 0xB8 /* [31:24] */=0A= +#define SIT9531X_PLL_REG_DBG_DATA_4 0xB9 /* [34:32] + sign */=0A= +=0A= +/* Read code of the TDC phase tap, and the sign bit of its sample */=0A= +#define SIT9531X_DBG_READ_CODE_TDC 69=0A= +#define SIT9531X_TDC_SIGN_BIT 3=0A= +#define SIT9531X_TDC_MAG_HI_MASK GENMASK(2, 0)=0A= +=0A= /* DIVN is carried as fixed point, in steps of 1e-12 of a whole divider */= =0A= #define SIT9531X_DIVN_SCALE 1000000000000ULL=0A= =0A= -- =0A= 2.39.2 (Apple Git-143)=0A= =0A=