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=klVYGXWH+//YzG0zpHqyYpnd0fSMzxVVkGDRMWHwNvqOWW5GBFnSpr+2XhrfkDsDGofe zicMhe/y6t19ZJvLGSebGZ4sr5ZWTwNXs2Xgn4s4xgBTy3p7gf4YUJ1OBCcnbotE+a6Im /LyRFS/sBA5xCByKStsQ8w5fUHHcRJkrWxQy55HN8LhYd1S+9lj3iLMauAdsVLUbJ41zU /m/GaOR1rjHvqk4ZRZNra12kj3IGAxVI0fgGGFwZ+8xjZfKW8yZDPmj05c/S4/NZcDv3B rmxhgCmunrO116zdhryosIX8ErpzG/V65jUrx/5PlhTBdf1ZlY7T0gnRJ91HuSw+NAw== 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=9eeQbLR0+BA3ZZyoBarMkkMBZnhRVopb74x5WXp6iUE=; b=Bn0oqFXjuii2+oqWZm2PXKfrM7FL8KukpYhVPWQ8Ucwa5sNMaU07+vnwWShfcDNW7Qnz K1uxJUUH36o8eQs1hMaZozYNEzoiP3S7WwYiQSEdDga0bWPLp3z3c74Gtsh3Hw5JCik00 RflmIpcLhBgkSK0+uwCNuepV9f2Ecl99tlcCJXHb2t0Az6deJFz7fY0f/sKDxib5JQiMb AjeUDbCfoQXG14rYGPUD+hVgxElC/vYnzjrIgeHiff4EzI+U0NbHty2DMepkslhscD7Ej QW8wm4s+odEZi0ixPnNXgQUHt+BNz95kyjiMuIQ7JNAf/UrA3CtzfLJ/a631givmPpA== 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=Gf+FyCHt; dkim=pass header.d=Sitime.onmicrosoft.com header.i=@Sitime.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-Sitime-onmicrosoft-com header.b=m3TVsSW4; 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 417D2606BAE8; Tue, 1 Dec 2026 23:52:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 417D2606BAE8 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=Gf+FyCHt; 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=m3TVsSW4 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=9eeQbLR0+BA3ZZyoBarMkkMBZnhRVopb74x5WXp6iUE=; b=Gf+FyCHtFtBXuk7M+kkYTa5A3yW8PQd3wdlb9VCn816MRFq2Qi07SaW8Vylw39cxtgUKXCxWMKM0ph0DbrOfw4q3qs/npWUCnGaypW0ZhPeeH8EqrufPviBalaJO+ymViv0byRwKV2U+QBBDN/J3t6yPl7Ck7KWxNoBNIEYcqk7RFvO9AKOaQ25m+FZEjKaPmUYQsb6mlaYKiMJohB4lDyoOWK0W547C1unjaUUR07oOw8xtqXOb2QhQZMJ6/Efoc563jZmIMJ/UU5vpszdIR1z4++PmXomLHiTzzzGT1Ne8Jl89Zapems3n2ybi3Qy4qV6fr4QXt4ZX8eEJSgmHoQ== 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 1F93D24007E; Tue, 1 Dec 2026 23:52:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tCvr96ILeGZoiQfBpY3Z8EdiXAy35nKybBaU8xx+RcsDWiWOauD22oQTVR2x3GB4Gvix8AgLSGiAhCMCQ3rIx+85aGxe3d64clk3w+J8bkMosGyXKf0rvSNonjyiyysfsXaZg3ZR2eqwY9W2KFaWN0TTo9f5nhC1/Q8MQOIEw6YPN8h5i9JULPELxxLMFgvWSVIf/1fI/i1cCTwJWnktrklEyteg2IIhGFT5YLcHNlQT7zskPaOSlASjeE0D8PQAub/NtXuswKzlzZ7OUvjD4QqnMVqrPsYKn75qQESyqiPJHXkHet4swVJTtQvV0H/Qjuz6WPcDBKuwt/TBcX3Qiw== 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=9eeQbLR0+BA3ZZyoBarMkkMBZnhRVopb74x5WXp6iUE=; b=VVY25w24Z8OPAJS0Nmk7LGEzM/YAp6C5GVoYMgl82Omzw/NYBI06bS5y2SjCqQ+v+YmUu3zu2hhEOGEgzoXqvQHvSdactpuZP3qoOeHp0N7vzPZUDZzoLmmcYbe42TXUnDMRITICqfJ9FUfVRoF1sail29y7vgMllspZ3kTsFakzjZ111JsYN1uN+JImgMGIzXuwlUa1TI8npJivV2SUMMhwZW30Q76XsiKiyU4VRtkv0X8MyssQSK9OzuUFthJ3aIwFZ1DFcB3ti9sj0W0OfCJsz+iMTlKvVR0vkCcLWLe99wEXRq+dXZKHh/9MO16AZRQ9QopPIe8Q1bTQ5NYvJA== 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=9eeQbLR0+BA3ZZyoBarMkkMBZnhRVopb74x5WXp6iUE=; b=m3TVsSW4majsTuaDL9M6EAVDVqUyBMoW/ad87BWOMRU5YXgEmEjRmeGcQgejJHZlHP5JnhxUXO++48pLBAiOEdJasIZ6DWaaPfkwnmQo4XJD83XTrOeaC/DGPkMTcPfyptOZxZ+EIroxsc+GtLhlKybPsGzD7M0DZPTcmypqq5gbgTGOte635sZjiMf3MPalD6qjjKJNeb09ZEAq5ljnEGhgrArYJzk/SMlWLyOOkkk3T0pVpaM1QzNhEloq/zT5UGHDTkVCZw5Jx9dy4I4ImYiz7gJchIl8T4XqCFgFRrEkdR/xr6iFiaIxebwnZR4J2H4EQkLuhgQX3qef+ziPqg== 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:15 +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:15 +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 08/13] dpll: sit9531x: add support to get and set priority on input pins Thread-Topic: [PATCH net-next v17 08/13] dpll: sit9531x: add support to get and set priority on input pins Thread-Index: AQHdge746Y1cfhhY0UufjhFCC2nKrA== Date: Tue, 1 Dec 2026 23:52:06 +0000 Message-ID: <20261201235202.97645-9-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: 2faf98e8-435f-4192-f72a-08df500620b0 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|261026135527099003|261022075727099003|261026121527099003|261022115727099003|261021123027099003|261026130827099003|261021135927099003|261022113327099003|261021121427099003|261026140227099003|261022105027099003|261021130227099003|261028144727099003|261102123227099003|261021133027099003|261009223027099003|22082099003|18002099003|6133799003|3023799007; x-microsoft-antispam-message-info: Bd7cXYBs+/U+taWk4wpgByoFIGTUgF7MEMzJOCGTQn/ADc9R0vUIX2JCM9YUOnQeZYWiJZzzEtCe2FrOndwEb36IdsHQzRNeHkr5zVCRnN1xnY/imACRWJviI0DhhRE8q9w1+qUyvUXystP9Vh/jEkJdUwZIOoVk/rckLpzAp0NgG97SMWN5Cy0VBnef0AIRCDpw25PwSERAwTK+xVGEsKrs8fg/8gKqoilvrkzXKQDhVGZ7ZYGVKgrDsUKPdth1A3Qf0Wu6BHLSAmEqTjNatEzctCHs1PcKQkqgQS8PuusREONmf72Swj+9h7KrWQ9nr2ab4h8p1oL82hRkd721WVY7UKMCtQgOZ+eFJXA4CN/d7A+8ZUgWXmit8EzYluYbe46An91drKlRrB7ChlpLMC+TaubHzsLPYESqx40G9/e0POdYtG/eW2r7bdtrI6tIjKPP5kTxeMjLbKSts4WFEWV16av9iYadc6MvnmZF89LvsMlcYmad06xS+ohXaotU6mUEG+c3ikN9e4ZoniO+At2x/Pt0qXvmpS+44Tjw5fhi37Mz+rLx3hrp8ZRPa4qAzlRd4Qsj7vOs3hIVzQI1XdwC5c2OIzC4f7zvZY3GfHi7UnZ24dV19z/lDlc/2dnPmwxGuDDpb50+3/lQ9cQw37Mk5D/2D7fd14405911v0898Ud2nGlu0oYIqLiRfeAHMs7uA2wFrXJvNI76mUE3dhaEfiGyc7oonK3CRF1S2l4= 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)(261026135527099003)(261022075727099003)(261026121527099003)(261022115727099003)(261021123027099003)(261026130827099003)(261021135927099003)(261022113327099003)(261021121427099003)(261026140227099003)(261022105027099003)(261021130227099003)(261028144727099003)(261102123227099003)(261021133027099003)(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?T50qEHQw+lBAmV9Oukt7R1fqows9vUOvdVtMGE6PbcuTguw1o1eWf8FQ90?= =?iso-8859-1?Q?SOP3Jr+PumxAKqwo66i6nZ+swlqeIf+qvP+bkf+Ouv0VUTvAMtsfHNghz0?= =?iso-8859-1?Q?D9fkkUsAHDy2Gf7Z4NrlHYIZxPmqxZ7ympQTbjkAsLKe9neqxPreLDyYQc?= =?iso-8859-1?Q?NOeIwjNgXwdBU74EL1UyE+Oy3Cv87Mal4TlKReIhtcTHNRAB3bGbDdkawM?= =?iso-8859-1?Q?GRjKv0NTJXVlVZkEnGGQ0IGDQkfy9e5IjBobfkXrF9Uku51Vl5DmEH9Rrf?= =?iso-8859-1?Q?24Snch/SdLw3UY5UbFVa5u8XEsRrq2DBZs3T3hotD4+O+7vQW8/8FWucXQ?= =?iso-8859-1?Q?WI5kv3o1CZI6tpPfzhMzmlZMLr5FUwNjFGtE7u3oDO/pOSrZ2c/mEOhxjj?= =?iso-8859-1?Q?DMoEHjfWxAHD0XtLzfPzGozPVMIsLBRot2rCUjrl3Z1e3ic2Q/IoQJhUtv?= =?iso-8859-1?Q?u4ks0eWsH1ItHYyBPq6BJezc2i7SekHAPrZc9fvDwyEU71WNDhtWId94GN?= =?iso-8859-1?Q?SKgonkr3qzZF691+T5xBk+gN8plAzNudmcnWdxb2u9YYIFAjx+q/o2TsCr?= =?iso-8859-1?Q?5aT6yI9Wh6q3T8n24ZlFw+0ByjFtNsyqDD2r5geZ7haP2IZJ8K7q6JD0IV?= =?iso-8859-1?Q?jQ9EBZrkDoGAZft2zTE+5bW8TzDQOYIooc59gVSNtn2KRPw/1HiCGTKc19?= =?iso-8859-1?Q?bCo154hb7i0ySPmQjAa+faT5pQNXXahB0+p2EL4S47aOEy4Q8ZH8/vibRP?= =?iso-8859-1?Q?Hl7x10P/KW2+jNo8j1kCkXEfcsetTaQ8IOitonZVcuNDS7naNt3BNTINau?= =?iso-8859-1?Q?f/ueZ3Kpj+wVVhXd4bSoiwQI7OA0kOrE2kXZMAbT8CZQRbgYoGum/y15tq?= =?iso-8859-1?Q?nax9nU1GeVjfjI4skIE0pVoskFV05tRxcR0FGJciYHxWHe/MCedYh+MSMA?= =?iso-8859-1?Q?E6f95A8dKIhxWjvoT+Iqx9jkImId+JDzgKYfX1FsA7gjoNzTwN5uWwBE8N?= =?iso-8859-1?Q?pocCId7OIgcbfVhuN1i8u6ig6WKVW6sg1voN7tSlpqU4t4HPLj3XFqANlS?= =?iso-8859-1?Q?mbGyGYmlceENun4HMkhOrE+snABclED0f/Eli46Hkl9sc284xTeB0+g7vJ?= =?iso-8859-1?Q?RlyNMCZHM15AFHsjs3c2l7M3qNm/6iM4zHocwLI+t2sjqbbfQvx4HRMwJp?= =?iso-8859-1?Q?bSE+YoFekSjLU1QCZkIOHkNzO3oQ76SyuyfWM+5//1qbQMz5mkCPZj3i8B?= =?iso-8859-1?Q?fHLCQ7ve5sIdxuUX+JQRtdLSmFypju897as79BQWA5Ko4b900HzBNQCDoX?= =?iso-8859-1?Q?HrFwf7Rf/RzolC+TFskWs/HVMTkAxjHklLdf19hr5I980BruAnw/rlPF20?= =?iso-8859-1?Q?CfscxsXXw/Lez90fYlyNdgLACzvwLZUjK7b5mv9gTbTXhM8932WT/uSjP+?= =?iso-8859-1?Q?FLD6ERQEx/sv+pHJrdczL45jI7WClSkI+ESvruigLi+9k87sK6V5gpJ4Mm?= =?iso-8859-1?Q?F5XMt9NcHtuB3N8v00k4RvUxTuY8IB2R2jPerJkCp4jC+DpwpAy9CyM1hX?= =?iso-8859-1?Q?4uT/PxqK7rLqMdXD5HpVVooxbkrxV5xLmM10Vl3tIpfkbfMfIi80SQladT?= =?iso-8859-1?Q?HfiXHqpkI/d+5QqYJR/WqYDAVOa7MDPVLjU2hu7Kg0tvreVQEk5+4ghGYu?= =?iso-8859-1?Q?dXGfBqVlPs144ho0U8GDX/vgq3xto5SYWXukG7lRB5PvYTJvOY6D+lIErI?= =?iso-8859-1?Q?yUnzTtHqinZ8ve4VDTelNXt58/I3/ykJnxhQBSaTdaCxvH?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Exchange-RoutingPolicyChecked: O6S5bCEvqPJ5RlDKLfNzjU2t/7y+WNbo65wzqa47FHatFmmTT8tsisrqW0BgZiHkmN4hbaALb0RN4tTG1zczzkQjscfNlDTD5zlV7LVw427PIgeFZtoSuNOii2JYG/zvBiMdh5Ie/XYvsfwqTlVSsEpKk/nfVGUim0iwh7Cgt53T96JkRYBxO8Ds6plfZserZBPrb+bdHCtkVRk0Lvc9rNPbMkMomTSbqHBJ4GQnCfOAjMlSpSJ1em5xjD2tGniJcsNJxDAkYGhuDqt2sotYlCtF8TzNuZmu125p+ygrvuWUHm9Dd4TweoHE0Z7raRNhxSHHhC87SOwdNvgWxBm1Tg== 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: 2faf98e8-435f-4192-f72a-08df500620b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Dec 2026 23:52:06.7033 (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: M1vuDEG5DsJMqKs/x8FFmiB7Mfob5xIcSfHUf0eGN2u8VTjzgv1y7ZzLexxXtz8YYavy28g+WWOCvw0uN9X1Rw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR20MB6330 X-MDID: 1796169139-LR7lvLwl1Ibc X-PPE-STACK: {"stack":"us1"} X-MDID-O: us1;at1;1796169139;LR7lvLwl1Ibc;;ba04557de9d2da8490f5f1e6de07b967 X-PPE-TRUSTED: V=1;DIR=OUT; From: Oleg Zadorozhnyi =0A= =0A= Let userspace read and set the priority kept per input and PLL; a set=0A= rebuilds the table from it. Priority and state are separate: a priority=0A= set on a disconnected input applies once the input is made selectable.=0A= The range is 0 to 255 over eleven slots; inputs of equal priority keep=0A= their table order.=0A= =0A= A table write that leaves the best live source unchanged keeps as the=0A= active selection the source the PLL tracks, read at the write, or the=0A= selected one it acquires, so the PLL does not restart acquisition for=0A= it. The XO pin of an automatic PLL reports, read-only, the priority the=0A= table is built with for the oscillator.=0A= =0A= A table rewritten outside the driver, by a profile reload or an I2C=0A= tool, becomes the new configuration. The poll compares each pin with a=0A= record taken at registration and after a state request that succeeds,=0A= which the core notifies, and notifies a changed operational state or=0A= priority; a notification that fails is sent again on a later tick.=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 | 181 +++++++++++++++++++++++----=0A= drivers/dpll/sit9531x/core.h | 8 +-=0A= drivers/dpll/sit9531x/dpll.c | 232 ++++++++++++++++++++++++++++++-----=0A= drivers/dpll/sit9531x/dpll.h | 4 +-=0A= drivers/dpll/sit9531x/prop.c | 7 +-=0A= 5 files changed, 371 insertions(+), 61 deletions(-)=0A= =0A= diff --git a/drivers/dpll/sit9531x/core.c b/drivers/dpll/sit9531x/core.c=0A= index d0305cbf12d5..6e06e99e5ff8 100644=0A= --- a/drivers/dpll/sit9531x/core.c=0A= +++ b/drivers/dpll/sit9531x/core.c=0A= @@ -609,6 +609,33 @@ bool sit9531x_input_prio_present(struct sit9531x_dev *= sitdev, u8 pll_idx,=0A= return !!(sitdev->chan[pll_idx].prio_mask & BIT(input_idx));=0A= }=0A= =0A= +/*=0A= + * @input_idx is in hardware encoding (see sit9531x_input_hw_src()). A sou= rce=0A= + * the PLL has never listed reports the last slot index, 10. Caller must h= old=0A= + * sitdev->multiop_lock.=0A= + */=0A= +int sit9531x_input_prio_get(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + u8 input_idx, u8 *prio)=0A= +{=0A= + const struct sit9531x_chan *chan;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (pll_idx >=3D SIT9531X_NUM_PLLS)=0A= + return -EINVAL;=0A= + input_idx =3D sit9531x_prio_src_canon(sitdev, input_idx);=0A= + if (input_idx >=3D SIT9531X_PRIO_NUM_SRC)=0A= + return -EINVAL;=0A= +=0A= + chan =3D &sitdev->chan[pll_idx];=0A= + if (chan->cfg_known & BIT(input_idx))=0A= + *prio =3D chan->cfg_prio[input_idx];=0A= + else=0A= + *prio =3D SIT9531X_PRIO_MAX_SLOTS - 1;=0A= +=0A= + return 0;=0A= +}=0A= +=0A= /*=0A= * Take the configured priorities from the hardware table: a listed source= gets=0A= * the first slot it occupies.=0A= @@ -726,6 +753,7 @@ static void sit9531x_prio_mask_build(struct sit9531x_de= v *sitdev, u8 pll_idx,=0A= =0A= static int sit9531x_prio_table_read(struct sit9531x_dev *sitdev, u8 pll_id= x,=0A= u8 *srcs);=0A= +static int sit9531x_chan_lock_fetch(struct sit9531x_dev *sitdev, u8 pll_id= x);=0A= static int sit9531x_chan_state_fetch(struct sit9531x_dev *sitdev, u8 pll_i= dx);=0A= =0A= static u8 sit9531x_prio_top_live(const struct sit9531x_dev *sitdev,=0A= @@ -764,14 +792,14 @@ static u8 sit9531x_prio_table_code(const struct sit95= 31x_dev *sitdev,=0A= }=0A= =0A= /*=0A= - * Pick the active selection to latch. The PLL keeps the selected source= =0A= - * unless the best live source changed; an @idle PLL, found without a=0A= - * reference by the poll, takes the best live source. The pick is the code= =0A= - * the table lists the source by.=0A= + * Pick the active selection to latch. The PLL keeps the source it tracks,= or=0A= + * the selected one it acquires, unless the best live source changed; an @= idle=0A= + * PLL, found without a reference by the poll, takes the best live source.= The=0A= + * pick is the code by which the table lists the source.=0A= */=0A= static u8 sit9531x_prio_activesel_pick(struct sit9531x_dev *sitdev,=0A= const u8 *old, const u8 *srcs, u8 cur,=0A= - bool idle)=0A= + u8 routed, bool idle)=0A= {=0A= u8 top, code, i;=0A= =0A= @@ -780,6 +808,13 @@ static u8 sit9531x_prio_activesel_pick(struct sit9531x= _dev *sitdev,=0A= (idle || top !=3D sit9531x_prio_top_live(sitdev, old)))=0A= return sit9531x_prio_table_code(sitdev, srcs, top);=0A= =0A= + if (sit9531x_prio_src_usable(routed) &&=0A= + sit9531x_prio_src_live(sitdev, routed)) {=0A= + code =3D sit9531x_prio_table_code(sitdev, srcs, routed);=0A= + if (code !=3D SIT9531X_PRIO_SRC_NONE)=0A= + return code;=0A= + }=0A= +=0A= cur =3D sit9531x_prio_src_canon(sitdev, cur & SIT9531X_PRIO_NIBBLE_MASK);= =0A= =0A= if (sit9531x_prio_src_usable(cur) &&=0A= @@ -818,6 +853,16 @@ static int sit9531x_prio_table_commit(struct sit9531x_= dev *sitdev, u8 pll_idx,=0A= memcpy(back, chan->table_pending ? chan->table_back : chan->prio_srcs,=0A= sizeof(back));=0A= =0A= + /*=0A= + * Sample the lock state and the routed source for the pick before the=0A= + * forced holdover changes them.=0A= + */=0A= + if (!empty) {=0A= + rc =3D sit9531x_chan_lock_fetch(sitdev, pll_idx);=0A= + if (rc)=0A= + return rc;=0A= + }=0A= +=0A= /*=0A= * Treat a forced holdover as set by this driver only when the table is= =0A= * empty, when the driver kept it for an empty table, or when a release= =0A= @@ -873,15 +918,23 @@ static int sit9531x_prio_table_commit(struct sit9531x= _dev *sitdev, u8 pll_idx,=0A= =0A= if (!empty) {=0A= u8 sel =3D sit9531x_prio_slot_get(val, slot + 1);=0A= + u8 routed =3D SIT9531X_PRIO_SRC_NONE;=0A= bool idle;=0A= =0A= + /*=0A= + * The pick needs the signal state now, not as of the last poll;=0A= + * the routed source and the lock state were sampled before this=0A= + * write forced holdover.=0A= + */=0A= rc =3D sit9531x_input_mon_fetch(sitdev);=0A= if (rc)=0A= goto rollback;=0A= + if (chan->routed_ref !=3D SIT9531X_REF_INVALID)=0A= + routed =3D sit9531x_input_hw_src(chan->routed_ref);=0A= idle =3D reselect && (!chan->locked || chan->inner_lol ||=0A= chan->mode || chan->ho_freeze);=0A= sel =3D sit9531x_prio_activesel_pick(sitdev, chan->prio_srcs,=0A= - srcs, sel, idle);=0A= + srcs, sel, routed, idle);=0A= val =3D sit9531x_prio_slot_set(val, slot + 1, sel);=0A= }=0A= =0A= @@ -1043,6 +1096,59 @@ static int sit9531x_prio_table_apply(struct sit9531x= _dev *sitdev, u8 pll_idx,=0A= return sit9531x_prio_table_commit(sitdev, pll_idx, srcs, false);=0A= }=0A= =0A= +/*=0A= + * Check if the device holds the table the configured priorities give for= =0A= + * @members.=0A= + */=0A= +static bool sit9531x_prio_table_held(struct sit9531x_dev *sitdev, u8 pll_i= dx,=0A= + u16 members)=0A= +{=0A= + u8 srcs[SIT9531X_PRIO_MAX_SLOTS];=0A= +=0A= + sit9531x_prio_table_build(sitdev, pll_idx, members, srcs);=0A= +=0A= + return !memcmp(srcs, sitdev->chan[pll_idx].prio_srcs, sizeof(srcs));=0A= +}=0A= +=0A= +/*=0A= + * @input_idx is in hardware encoding (0-11, see sit9531x_input_hw_src()).= A=0A= + * source not in the table keeps the priority for when it is connected. Ca= ller=0A= + * must hold sitdev->multiop_lock.=0A= + */=0A= +int sit9531x_input_prio_set(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + u8 input_idx, u8 prio)=0A= +{=0A= + struct sit9531x_chan *chan;=0A= + u16 old_known;=0A= + u8 old_prio;=0A= + int rc;=0A= +=0A= + lockdep_assert_held(&sitdev->multiop_lock);=0A= +=0A= + if (pll_idx >=3D SIT9531X_NUM_PLLS)=0A= + return -EINVAL;=0A= + input_idx =3D sit9531x_prio_src_canon(sitdev, input_idx);=0A= + if (input_idx >=3D SIT9531X_PRIO_NUM_SRC)=0A= + return -EINVAL;=0A= +=0A= + chan =3D &sitdev->chan[pll_idx];=0A= + old_prio =3D chan->cfg_prio[input_idx];=0A= + old_known =3D chan->cfg_known;=0A= + chan->cfg_prio[input_idx] =3D prio;=0A= + chan->cfg_known |=3D BIT(input_idx);=0A= +=0A= + if (!(chan->prio_mask & BIT(input_idx)))=0A= + return 0;=0A= +=0A= + rc =3D sit9531x_prio_table_apply(sitdev, pll_idx, chan->prio_mask);=0A= + if (rc && !sit9531x_prio_table_held(sitdev, pll_idx, chan->prio_mask)) {= =0A= + chan->cfg_prio[input_idx] =3D old_prio;=0A= + chan->cfg_known =3D old_known;=0A= + }=0A= +=0A= + return rc;=0A= +}=0A= +=0A= /*=0A= * Removing the last source leaves an empty table, which keeps the PLL in= =0A= * holdover. Caller must hold sitdev->multiop_lock.=0A= @@ -1333,14 +1439,13 @@ static int sit9531x_chan_routed_ref_read(struct sit= 9531x_dev *sitdev,=0A= }=0A= =0A= /*=0A= - * Read the PLL's run, lock and holdover state, mode, selection and priori= ty=0A= - * table.=0A= + * Read the PLL's run, lock and holdover-freeze state and, while it tracks= a=0A= + * reference, the routed source. Caller must hold sitdev->multiop_lock.=0A= */=0A= -static int sit9531x_chan_state_fetch(struct sit9531x_dev *sitdev, u8 pll_i= dx)=0A= +static int sit9531x_chan_lock_fetch(struct sit9531x_dev *sitdev, u8 pll_id= x)=0A= {=0A= - u8 status, outer_lol, inner_lol, ho_freeze, pll_status_1;=0A= struct sit9531x_chan *chan =3D &sitdev->chan[pll_idx];=0A= - u8 srcs[SIT9531X_PRIO_MAX_SLOTS];=0A= + u8 status, outer_lol, inner_lol, ho_freeze;=0A= u8 routed =3D SIT9531X_REF_INVALID;=0A= bool active, tracking;=0A= int rc;=0A= @@ -1386,6 +1491,34 @@ static int sit9531x_chan_state_fetch(struct sit9531x= _dev *sitdev, u8 pll_idx)=0A= return rc;=0A= }=0A= =0A= + /* STATUS_1_GENERIC reports loss of lock, so invert it. */=0A= + chan->active =3D active;=0A= + chan->locked =3D active && !(outer_lol & BIT(pll_idx));=0A= + chan->mode =3D !!(status & SIT9531X_PLL_STATUS_OUTER_DIS);=0A= + chan->routed_ref =3D routed;=0A= + if (chan->manual_input && routed !=3D SIT9531X_REF_INVALID)=0A= + chan->manual_ref =3D routed;=0A= + chan->inner_lol =3D !!(inner_lol & BIT(pll_idx));=0A= + chan->ho_freeze =3D !!(ho_freeze & BIT(pll_idx));=0A= +=0A= + return 0;=0A= +}=0A= +=0A= +/*=0A= + * Read the PLL's run, lock and holdover state, mode, selection and priori= ty=0A= + * table.=0A= + */=0A= +static int sit9531x_chan_state_fetch(struct sit9531x_dev *sitdev, u8 pll_i= dx)=0A= +{=0A= + struct sit9531x_chan *chan =3D &sitdev->chan[pll_idx];=0A= + u8 srcs[SIT9531X_PRIO_MAX_SLOTS];=0A= + u8 pll_status_1;=0A= + int rc;=0A= +=0A= + rc =3D sit9531x_chan_lock_fetch(sitdev, pll_idx);=0A= + if (rc)=0A= + return rc;=0A= +=0A= rc =3D sit9531x_read_pll_u8(sitdev, pll_idx, SIT9531X_PLL_REG_STATUS_1,= =0A= &pll_status_1);=0A= if (rc)=0A= @@ -1408,15 +1541,6 @@ static int sit9531x_chan_state_fetch(struct sit9531x= _dev *sitdev, u8 pll_idx)=0A= sit9531x_prio_cfg_seed(sitdev, pll_idx, srcs);=0A= }=0A= =0A= - /* STATUS_1_GENERIC reports loss of lock, so invert it. */=0A= - chan->active =3D active;=0A= - chan->locked =3D active && !(outer_lol & BIT(pll_idx));=0A= - chan->mode =3D !!(status & SIT9531X_PLL_STATUS_OUTER_DIS);=0A= - chan->routed_ref =3D routed;=0A= - if (chan->manual_input && routed !=3D SIT9531X_REF_INVALID)=0A= - chan->manual_ref =3D routed;=0A= - chan->inner_lol =3D !!(inner_lol & BIT(pll_idx));=0A= - chan->ho_freeze =3D !!(ho_freeze & BIT(pll_idx));=0A= chan->ho_valid =3D !!(pll_status_1 & SIT9531X_PLL_STATUS_1_HO_VALID);=0A= chan->stale =3D false;=0A= =0A= @@ -2333,8 +2457,8 @@ static void sit9531x_dpll_pins_unregister(struct sit9= 531x_dpll *sitdpll)=0A= sit9531x_dpll_pin_unregister(pin);=0A= =0A= /*=0A= - * Detached under multiop_lock, as every list change is; the poll is=0A= - * already canceled or not yet queued.=0A= + * Detached under multiop_lock, which callbacks walking the list hold;=0A= + * the poll is already canceled or not yet queued.=0A= */=0A= mutex_lock(&sitdev->multiop_lock);=0A= list_splice_init(&sitdpll->pins, &dead);=0A= @@ -2387,13 +2511,24 @@ static int sit9531x_dpll_pins_register(struct sit95= 31x_dpll *sitdpll)=0A= goto error;=0A= }=0A= =0A= + /*=0A= + * Taken before the pin is published; see=0A= + * sit9531x_dpll_pin_baseline().=0A= + */=0A= + mutex_lock(&sitdpll->dev->multiop_lock);=0A= + sit9531x_dpll_pin_baseline(pin);=0A= + mutex_unlock(&sitdpll->dev->multiop_lock);=0A= +=0A= rc =3D sit9531x_dpll_pin_register(pin, index);=0A= if (rc) {=0A= kfree(pin);=0A= goto error;=0A= }=0A= =0A= - /* List changes are made under multiop_lock */=0A= + /*=0A= + * Earlier pins are already reachable from netlink, and the=0A= + * walks over this list run under multiop_lock.=0A= + */=0A= mutex_lock(&sitdpll->dev->multiop_lock);=0A= list_add(&pin->list, &sitdpll->pins);=0A= mutex_unlock(&sitdpll->dev->multiop_lock);=0A= diff --git a/drivers/dpll/sit9531x/core.h b/drivers/dpll/sit9531x/core.h=0A= index 31c7d434978a..222f34a79b9b 100644=0A= --- a/drivers/dpll/sit9531x/core.h=0A= +++ b/drivers/dpll/sit9531x/core.h=0A= @@ -130,8 +130,8 @@ struct sit9531x_out {=0A= * @active: PLL reached its active state; an unused PLL never does and its= =0A= * loss-of-lock bit stays clear=0A= * @locked: PLL is active and its outer loop reports lock=0A= - * @stale: last state read failed; the fields hold the previous sample and= =0A= - * are not reported=0A= + * @stale: last state read failed; the fields hold an earlier sample, or= =0A= + * part of a new one, and are not reported=0A= * @mode: 0 =3D sync (outer loop enabled), 1 =3D free-run=0A= * @routed_ref: input the device routes to the PLL, as a logical index=0A= * (INTSYNC: SIT9531X_INTSYNC_PIN_ID); SIT9531X_REF_INVALID if none=0A= @@ -287,6 +287,10 @@ int sit9531x_input_enable(struct sit9531x_dev *sitdev,= u8 index);=0A= =0A= bool sit9531x_input_prio_present(struct sit9531x_dev *sitdev,=0A= u8 pll_idx, u8 input_idx);=0A= +int sit9531x_input_prio_set(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + u8 input_idx, u8 prio);=0A= +int sit9531x_input_prio_get(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= + u8 input_idx, u8 *prio);=0A= int sit9531x_input_prio_remove(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= u8 input_idx);=0A= int sit9531x_input_prio_add(struct sit9531x_dev *sitdev, u8 pll_idx,=0A= diff --git a/drivers/dpll/sit9531x/dpll.c b/drivers/dpll/sit9531x/dpll.c=0A= index 5d16183aa1ae..3a31d0707127 100644=0A= --- a/drivers/dpll/sit9531x/dpll.c=0A= +++ b/drivers/dpll/sit9531x/dpll.c=0A= @@ -34,6 +34,14 @@ sit9531x_dpll_is_xo_pin(const struct sit9531x_dpll_pin *= pin)=0A= pin->id =3D=3D SIT9531X_MAX_INPUTS;=0A= }=0A= =0A= +/* Check if the pin's state and priority can change without a request */= =0A= +static bool=0A= +sit9531x_dpll_is_selection_pin(const struct sit9531x_dpll_pin *pin)=0A= +{=0A= + return sit9531x_dpll_is_input_pin(pin) &&=0A= + !sit9531x_dpll_is_xo_pin(pin);=0A= +}=0A= +=0A= /*=0A= * A frozen PLL with an empty table is in forced holdover; report holdover= only=0A= * while its holdover memory is valid.=0A= @@ -180,7 +188,7 @@ const struct dpll_device_ops sit9531x_dpll_device_ops = =3D {=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.=0A= + * always CONNECTED and reports its priority read-only.=0A= */=0A= =0A= /* Caller must hold sitdev->multiop_lock. */=0A= @@ -403,6 +411,10 @@ sit9531x_dpll_input_pin_state_on_dpll_set(const struct= dpll_pin *pin,=0A= break;=0A= }=0A= =0A= + /* The core notifies this request; the poll compares to this record */=0A= + if (!rc)=0A= + sit9531x_dpll_pin_baseline(dpin);=0A= +=0A= mutex_unlock(&sitdev->multiop_lock);=0A= =0A= if (rc =3D=3D -ENOSPC)=0A= @@ -414,11 +426,82 @@ sit9531x_dpll_input_pin_state_on_dpll_set(const struc= t dpll_pin *pin,=0A= return rc;=0A= }=0A= =0A= +/* Report the configured priority of the source on this PLL, listed or not= */=0A= +static int=0A= +sit9531x_dpll_input_pin_prio_get(const struct dpll_pin *pin, void *pin_pri= v,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, u32 *prio,=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= + u8 slot;=0A= + int rc;=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + rc =3D sit9531x_input_prio_get(sitdev, sitdpll->id,=0A= + sit9531x_input_hw_src(dpin->id), &slot);=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + if (rc)=0A= + return rc;=0A= +=0A= + *prio =3D slot;=0A= + return 0;=0A= +}=0A= +=0A= +/*=0A= + * Rewrite the Page 1 priority table for a listed pin; an unlisted pin kee= ps the=0A= + * priority until it is connected.=0A= + */=0A= +static int=0A= +sit9531x_dpll_input_pin_prio_set(const struct dpll_pin *pin, void *pin_pri= v,=0A= + const struct dpll_device *dpll,=0A= + void *dpll_priv, u32 prio,=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= + int rc;=0A= +=0A= + if (dpin->dir !=3D DPLL_PIN_DIRECTION_INPUT) {=0A= + NL_SET_ERR_MSG(extack, "Priority applies only to input pins");=0A= + return -EINVAL;=0A= + }=0A= +=0A= + if (prio > U8_MAX) {=0A= + NL_SET_ERR_MSG(extack, "Priority out of range (0-255)");=0A= + return -EINVAL;=0A= + }=0A= +=0A= + mutex_lock(&sitdev->multiop_lock);=0A= + if (sit9531x_chan_state_get(sitdev, sitdpll->id)->manual_input) {=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= + return sit9531x_dpll_manual_select_refuse(extack);=0A= + }=0A= + rc =3D sit9531x_input_prio_set(sitdev, sitdpll->id,=0A= + sit9531x_input_hw_src(dpin->id),=0A= + (u8)prio);=0A= + if (!rc)=0A= + dpin->prio =3D prio;=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + if (rc) {=0A= + NL_SET_ERR_MSG(extack, "Failed to set input priority");=0A= + return rc;=0A= + }=0A= +=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= .state_on_dpll_get =3D sit9531x_dpll_input_pin_state_on_dpll_get,=0A= .state_on_dpll_set =3D sit9531x_dpll_input_pin_state_on_dpll_set,=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= };=0A= =0A= /*=0A= @@ -443,7 +526,10 @@ static const struct dpll_pin_ops sit9531x_dpll_input_p= in_manual_ops =3D {=0A= .operstate_on_dpll_get =3D sit9531x_dpll_input_pin_operstate_on_dpll_get,= =0A= };=0A= =0A= -/* The XO feeds every PLL and is always connected. */=0A= +/*=0A= + * The XO feeds every PLL and is always connected. The priority is the one= the=0A= + * PLL's table sorts the OCXO source by; it has no setter.=0A= + */=0A= =0A= static int=0A= sit9531x_dpll_xo_pin_state_on_dpll_get(const struct dpll_pin *pin,=0A= @@ -460,6 +546,13 @@ sit9531x_dpll_xo_pin_state_on_dpll_get(const struct dp= ll_pin *pin,=0A= static const struct dpll_pin_ops sit9531x_dpll_xo_pin_ops =3D {=0A= .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= .state_on_dpll_get =3D sit9531x_dpll_xo_pin_state_on_dpll_get,=0A= + .prio_get =3D sit9531x_dpll_input_pin_prio_get,=0A= +};=0A= +=0A= +/* For a PLL on manual input select, which uses no priority table */=0A= +static const struct dpll_pin_ops sit9531x_dpll_xo_pin_manual_ops =3D {=0A= + .direction_get =3D sit9531x_dpll_input_pin_direction_get,=0A= + .state_on_dpll_get =3D sit9531x_dpll_xo_pin_state_on_dpll_get,=0A= };=0A= =0A= static int=0A= @@ -482,19 +575,82 @@ const struct dpll_pin_ops *=0A= sit9531x_dpll_pin_ops_get(const struct sit9531x_dpll_pin *pin)=0A= {=0A= const struct sit9531x_dev *sitdev =3D pin->dpll->dev;=0A= + bool manual;=0A= =0A= if (!sit9531x_dpll_is_input_pin(pin))=0A= return &sit9531x_dpll_output_pin_ops;=0A= - if (sit9531x_dpll_is_xo_pin(pin))=0A= - return &sit9531x_dpll_xo_pin_ops;=0A= /* As read at probe, before any pin is registered */=0A= - if (sit9531x_chan_state_get(sitdev, pin->dpll->id)->manual_input)=0A= - return &sit9531x_dpll_input_pin_manual_ops;=0A= - return &sit9531x_dpll_input_pin_ops;=0A= + manual =3D sit9531x_chan_state_get(sitdev, pin->dpll->id)->manual_input;= =0A= + if (sit9531x_dpll_is_xo_pin(pin))=0A= + return manual ? &sit9531x_dpll_xo_pin_manual_ops :=0A= + &sit9531x_dpll_xo_pin_ops;=0A= + return manual ? &sit9531x_dpll_input_pin_manual_ops :=0A= + &sit9531x_dpll_input_pin_ops;=0A= +}=0A= +=0A= +/* Caller must hold sitdev->multiop_lock. */=0A= +static void sit9531x_dpll_pin_snapshot(struct sit9531x_dpll *sitdpll,=0A= + const struct sit9531x_dpll_pin *pin,=0A= + enum dpll_pin_state *state,=0A= + enum dpll_pin_operstate *operstate,=0A= + u8 *prio)=0A= +{=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + u8 id =3D pin->id;=0A= +=0A= + sit9531x_dpll_selection_state_get(sitdev, sitdpll, id, state);=0A= + sit9531x_dpll_selection_operstate_get(sitdev, sitdpll, id, operstate);=0A= + /* A PLL on manual input select reports no priority */=0A= + if (sit9531x_chan_state_get(sitdev, sitdpll->id)->manual_input ||=0A= + sit9531x_input_prio_get(sitdev, sitdpll->id,=0A= + sit9531x_input_hw_src(id), prio))=0A= + *prio =3D pin->prio;=0A= +}=0A= +=0A= +/*=0A= + * Record the priority the XO pin reports; return true if it changed. Call= er=0A= + * must hold sitdev->multiop_lock.=0A= + */=0A= +static bool sit9531x_dpll_xo_prio_update(struct sit9531x_dpll *sitdpll,=0A= + struct sit9531x_dpll_pin *pin)=0A= +{=0A= + struct sit9531x_dev *sitdev =3D sitdpll->dev;=0A= + u8 prio;=0A= +=0A= + if (sit9531x_chan_state_get(sitdev, sitdpll->id)->manual_input ||=0A= + sit9531x_input_prio_get(sitdev, sitdpll->id,=0A= + sit9531x_input_hw_src(pin->id), &prio) ||=0A= + prio =3D=3D pin->prio)=0A= + return false;=0A= +=0A= + pin->prio =3D prio;=0A= +=0A= + return true;=0A= +}=0A= +=0A= +/*=0A= + * Record what the pin reports, for the poll to compare: before the pin is= =0A= + * registered, so the first poll notifies a change a request made, and aft= er a=0A= + * state request that succeeded, which the core notifies. Caller must hold= =0A= + * sitdev->multiop_lock.=0A= + */=0A= +void sit9531x_dpll_pin_baseline(struct sit9531x_dpll_pin *pin)=0A= +{=0A= + struct sit9531x_dpll *sitdpll =3D pin->dpll;=0A= +=0A= + lockdep_assert_held(&sitdpll->dev->multiop_lock);=0A= +=0A= + if (sit9531x_dpll_is_xo_pin(pin))=0A= + sit9531x_dpll_xo_prio_update(sitdpll, pin);=0A= + if (!sit9531x_dpll_is_selection_pin(pin))=0A= + return;=0A= +=0A= + sit9531x_dpll_pin_snapshot(sitdpll, pin, &pin->pin_state,=0A= + &pin->operstate, &pin->prio);=0A= }=0A= =0A= /*=0A= - * Send notifications for changed lock status and pin state; called from= =0A= + * Notify a changed lock status, pin state or priority; called from=0A= * sit9531x_dev_periodic_work().=0A= */=0A= void sit9531x_dpll_changes_check(struct sit9531x_dpll *sitdpll)=0A= @@ -527,40 +683,52 @@ void sit9531x_dpll_changes_check(struct sit9531x_dpll= *sitdpll)=0A= if (sitdpll->ntf_pending && !dpll_device_change_ntf(sitdpll->dpll_dev))= =0A= sitdpll->ntf_pending =3D false;=0A= =0A= + mutex_lock(&sitdev->multiop_lock);=0A= list_for_each_entry(pin, &sitdpll->pins, list) {=0A= enum dpll_pin_operstate operstate;=0A= - const struct dpll_pin_ops *ops;=0A= enum dpll_pin_state state;=0A= bool changed;=0A= + u8 prio;=0A= =0A= - /*=0A= - * Only references change state or operational state without a=0A= - * request.=0A= - */=0A= - if (!sit9531x_dpll_is_input_pin(pin) ||=0A= - sit9531x_dpll_is_xo_pin(pin))=0A= + /* A table written outside the driver moves the XO priority */=0A= + if (sit9531x_dpll_is_xo_pin(pin)) {=0A= + pin->ntf_pending |=3D=0A= + sit9531x_dpll_xo_prio_update(sitdpll, pin);=0A= continue;=0A= + }=0A= =0A= - ops =3D sit9531x_dpll_pin_ops_get(pin);=0A= - rc =3D ops->state_on_dpll_get(pin->dpll_pin, pin,=0A= - sitdpll->dpll_dev, sitdpll,=0A= - &state, NULL);=0A= - if (rc)=0A= - continue;=0A= - rc =3D ops->operstate_on_dpll_get(pin->dpll_pin, pin,=0A= - sitdpll->dpll_dev, sitdpll,=0A= - &operstate, NULL);=0A= - if (rc)=0A= + if (!sit9531x_dpll_is_selection_pin(pin))=0A= continue;=0A= =0A= - changed =3D pin->seen && (state !=3D pin->pin_state ||=0A= - operstate !=3D pin->operstate);=0A= + sit9531x_dpll_pin_snapshot(sitdpll, pin, &state, &operstate,=0A= + &prio);=0A= +=0A= + changed =3D state !=3D pin->pin_state ||=0A= + operstate !=3D pin->operstate || prio !=3D pin->prio;=0A= + if (changed)=0A= + dev_dbg(sitdev->dev,=0A= + "%s: state %u->%u operstate %u->%u prio %u->%u\n",=0A= + pin->label, pin->pin_state, state,=0A= + pin->operstate, operstate, pin->prio, prio);=0A= +=0A= pin->pin_state =3D state;=0A= pin->operstate =3D operstate;=0A= - pin->seen =3D true;=0A= - if (changed) {=0A= - dev_dbg(sitdev->dev, "%s state changed\n", pin->label);=0A= - dpll_pin_change_ntf(pin->dpll_pin);=0A= - }=0A= + pin->prio =3D prio;=0A= +=0A= + /*=0A= + * The notification takes DPLL-subsystem locks the callbacks run=0A= + * under; send it after dropping multiop_lock.=0A= + */=0A= + if (changed)=0A= + pin->ntf_pending =3D true;=0A= + }=0A= + mutex_unlock(&sitdev->multiop_lock);=0A= +=0A= + list_for_each_entry(pin, &sitdpll->pins, list) {=0A= + if (!pin->ntf_pending)=0A= + continue;=0A= + if (dpll_pin_change_ntf(pin->dpll_pin))=0A= + continue;=0A= + pin->ntf_pending =3D false;=0A= }=0A= }=0A= diff --git a/drivers/dpll/sit9531x/dpll.h b/drivers/dpll/sit9531x/dpll.h=0A= index f1634ef99602..bf68455c3945 100644=0A= --- a/drivers/dpll/sit9531x/dpll.h=0A= +++ b/drivers/dpll/sit9531x/dpll.h=0A= @@ -29,9 +29,10 @@ struct sit9531x_dpll_pin {=0A= char label[8]; /* "IN0", "OUT3" */=0A= enum dpll_pin_direction dir;=0A= u8 id; /* hardware index */=0A= + u8 prio;=0A= enum dpll_pin_state pin_state;=0A= enum dpll_pin_operstate operstate;=0A= - bool seen; /* baseline taken by the poll */=0A= + bool ntf_pending;=0A= };=0A= =0A= struct sit9531x_dpll {=0A= @@ -57,6 +58,7 @@ int sit9531x_dpll_register(struct sit9531x_dpll *sitdpll= );=0A= void sit9531x_dpll_unregister(struct sit9531x_dpll *sitdpll);=0A= =0A= void sit9531x_dpll_lock_status_baseline(struct sit9531x_dpll *sitdpll);=0A= +void sit9531x_dpll_pin_baseline(struct sit9531x_dpll_pin *pin);=0A= void sit9531x_dpll_changes_check(struct sit9531x_dpll *sitdpll);=0A= =0A= #endif /* _SIT9531X_DPLL_H */=0A= diff --git a/drivers/dpll/sit9531x/prop.c b/drivers/dpll/sit9531x/prop.c=0A= index 7cc690d92c60..cfe1ab044c0b 100644=0A= --- a/drivers/dpll/sit9531x/prop.c=0A= +++ b/drivers/dpll/sit9531x/prop.c=0A= @@ -25,8 +25,8 @@=0A= static const u8 sit9531x_out_freq_mult[] =3D { 15, 20, 24, 30, 32, 40, 48 = };=0A= =0A= /*=0A= - * An input pin is registered with all four PLLs and takes a state request= =0A= - * on those found on automatic input selection at probe.=0A= + * An input pin is registered with all four PLLs and takes a state or=0A= + * priority request on those found on automatic input selection at probe.= =0A= */=0A= static u32 sit9531x_prop_input_caps(const struct sit9531x_dev *sitdev)=0A= {=0A= @@ -34,7 +34,8 @@ static u32 sit9531x_prop_input_caps(const struct sit9531x= _dev *sitdev)=0A= =0A= for (i =3D 0; i < SIT9531X_NUM_PLLS; i++) {=0A= if (!sit9531x_chan_state_get(sitdev, i)->manual_input)=0A= - return DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;=0A= + return DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE |=0A= + DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE;=0A= }=0A= =0A= return 0;=0A= -- =0A= 2.39.2 (Apple Git-143)=0A= =0A=