From patchwork Wed Mar 6 23:15:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 1052566 X-Patchwork-Delegate: patchwork@peda.user.lysator.liu.se Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axentia.se Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=axentia.se header.i=@axentia.se header.b="EM/i5hZS"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44F8lq4F30z9s7T for ; Thu, 7 Mar 2019 10:16:39 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726342AbfCFXQe (ORCPT ); Wed, 6 Mar 2019 18:16:34 -0500 Received: from mail-eopbgr80121.outbound.protection.outlook.com ([40.107.8.121]:12356 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725788AbfCFXQd (ORCPT ); Wed, 6 Mar 2019 18:16:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=slsS03ejtOmf8TTg9jT7a+19WEOqrpVOJATPfAwJwxI=; b=EM/i5hZSDh3dYBZYLDFp3UsRezeLc0OEC8GkRmlc40kHT1lB0YvJa1mPzZt54IdXruMOwGudKpHZ46A8iF3n21oc3RglcrSUxOaX0HgPk1LJhqz0x8LpjJQKtuy5HP3+/o96nt5O2KSPzySmn9rHs/hI6bLa60Hwo/hTw0spfwM= Received: from VI1PR02MB4542.eurprd02.prod.outlook.com (20.178.12.74) by VI1PR02MB4592.eurprd02.prod.outlook.com (20.178.12.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 23:15:35 +0000 Received: from VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1]) by VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 23:15:35 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Rob Herring , Mark Rutland , Guenter Roeck , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , Ken Chen , Pradeep Srinivasan Subject: [PATCH v2 1/5] i2c: mux: pca9541: use the BIT macro Thread-Topic: [PATCH v2 1/5] i2c: mux: pca9541: use the BIT macro Thread-Index: AQHU1HKAw6Qt9CwT4UqEobY8yAcuKg== Date: Wed, 6 Mar 2019 23:15:35 +0000 Message-ID: <20190306231521.29367-2-peda@axentia.se> References: <20190306231521.29367-1-peda@axentia.se> In-Reply-To: <20190306231521.29367-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR1001CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::26) To VI1PR02MB4542.eurprd02.prod.outlook.com (2603:10a6:803:b1::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e96e442a-353f-4417-ce85-08d6a289a32f x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:VI1PR02MB4592; x-ms-traffictypediagnostic: VI1PR02MB4592: x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39830400003)(396003)(366004)(346002)(136003)(189003)(199004)(5640700003)(53936002)(6486002)(71200400001)(6436002)(2501003)(71190400001)(99286004)(4326008)(6916009)(476003)(102836004)(76176011)(256004)(446003)(486006)(52116002)(3846002)(86362001)(386003)(74482002)(6506007)(6512007)(26005)(6116002)(97736004)(66066001)(305945005)(7736002)(2351001)(186003)(2616005)(11346002)(25786009)(106356001)(36756003)(8936002)(8676002)(68736007)(81156014)(81166006)(5660300002)(508600001)(2906002)(54906003)(1076003)(50226002)(316002)(14454004)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB4592; H:VI1PR02MB4542.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR02MB4592=3B23?= =?iso-8859-1?q?=3ApKBrbR+Za753uv7RNgCyykwhhna9HVcCFe8/E5Z3HakBCPTC?= =?iso-8859-1?q?/vuLFvvenHHGI9JUf13Wx7XbItn/pjn6z1puuSYDb/XbFAIXp77?= =?iso-8859-1?q?K+KYDU/4Ggh3LGrcGqXrMytBM6BoS8OyNwJFRbZOtXuWojjnlXe?= =?iso-8859-1?q?t47IBhC0nuyA7rqlk6b36frF7vdYV5EWzuWevOVK8HcyuiajTps?= =?iso-8859-1?q?+brfykEvtqtv/x+UCfZy8RQC9jPAugmDM6KT8ofJku89ITMCA8Z?= =?iso-8859-1?q?+9bHgBQMdFhn4yckjSJaGsDHdoOjOEAcDVMeXxsbcY4N0WC/VTn?= =?iso-8859-1?q?WBRCpf2mewWJ+wp0Q5l1X4McL7KheA5hgUGFSxdFMvcyTFOE+ll?= =?iso-8859-1?q?ooZSTmEhSq6NIHO2/wNTEfU+BXl2l7UOkDqvw3zQrYxJbLw8ymg?= =?iso-8859-1?q?HrGoTahCwbpCYWuB8wLjmTDmG8k5uR48UFAB+qBtcNK9iVEw+tM?= =?iso-8859-1?q?IcCiKW8LYTCA82qG26+qdXrqVW7ApHiwKFRqiahb2c4+dN3c/by?= =?iso-8859-1?q?MwHxCeZqMjM0rPbtQirAiaxSFI/EiiJdpQcBQ0NIyFsn1u8x9u+?= =?iso-8859-1?q?vDMMUAat4dEVs4SlK1mM6p+n2FZGJdusuWYnl2AEoxyVCrbnXel?= =?iso-8859-1?q?55hRdKomaOH5zTg2Dsy3y5j7TABbG9G8jeADhqJ1EOkuuvvoRH+?= =?iso-8859-1?q?X4qu2PT4ltXTcbZsQ4dJUrXiSmTR5F2G6SKWbzonUdMQJmG4bWO?= =?iso-8859-1?q?wL3xnyymGB5R6ktvTZhy0d55MqAtfGjzAkaR5nbpNCpFmF4pdVf?= =?iso-8859-1?q?1gyWALjrME9vRVmg2qebgMdoRjiEA50VxJ45AvinxMTlWFWYDWa?= =?iso-8859-1?q?F4yjyOu0h8/4PSaJMATI/GphDHDL7SeWGWchj0A9bhimJZ+sOZk?= =?iso-8859-1?q?XB2ikwyFq7wATMyRrmsDKlHPrXaT1wksIT6m86EbVMlhI7Z6O9W?= =?iso-8859-1?q?0OBK85RCcA1ySohoxotK1sgAMxEEun9d0jw7FhKoUJbslVISpTU?= =?iso-8859-1?q?DsAA2WryyAqPmBjWWLUSHGp4YZBo2X2zLxCuYaOXdXLCygh4RdG?= =?iso-8859-1?q?sCHaPd1A5Z53xqftmWAYxhdtXo2BiSMaUJ9igD6WIKTle6Cr4cf?= =?iso-8859-1?q?kXE7GgXPEZnqeB4jeh6nGPwerFFkAMYDM7H44PIGPu8KSXMuGu+?= =?iso-8859-1?q?aN6tl+S5YW9bhYMde8meJ8N5QklAP7Tah3beUwGbXmi1FiXku3p?= =?iso-8859-1?q?HA+EfdqRRmW8NKrLDAdCcH/EuGHwG1b83M0WuBuwg6tXkU0rnuK?= =?iso-8859-1?q?MkXEP1OfJj1Ut48zsstVNMiL2XyV7gWW80O+fln0QVskLSQZigJ?= =?iso-8859-1?q?Eg8e11T0Bdcg94OPmSBIOY0d2zFBqw=3D=3D?= x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ZblX8nqpgS/sNNJ6Qm6tDGAmmu17QcWBpe4+f0XF92joTNyTj9mFc+Eddu6DYGH/SMfVl6uv5t821w4WUw4p2oO0+pVZmPnvKRwz38KHVh5QMitunEvNrkwuHddsYvKVOeevJPogAy4euk7cuGBKJWvmu8mK19HBtXqA/dhKA7HRBFZdbu9UAfBJJtpQD5XNptzF4YECBE6nZcniHZTMFUyQJ4bkYz4Cu0L+D9thG8+6nILHDUIPxgjFlJBUHDQO5lwP9UkiVvpA4T6/oCTAF/NwLvmapBKKIrp6m1tkI1+oMB1pzOYgzfbC6YJcSep4u1XD4iBoV31/xah8zfG7W9DrTfWJKTrp59nL8pDIThxMm6Bo4X0cVvCRgJh5/meycqFCJDuBLRP+cHJuXLM/uhvLHrTyWj1ky4xxg6FIih8= MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: e96e442a-353f-4417-ce85-08d6a289a32f X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 23:15:35.3613 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB4592 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Because it looks nice! Reviewed-by: Guenter Roeck Reviewed-by: Vladimir Zapolskiy Signed-off-by: Peter Rosin Reviewed-by: Luca Ceresoli --- drivers/i2c/muxes/i2c-mux-pca9541.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index 9e75d6b9140b..30cabf482985 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c @@ -16,6 +16,7 @@ * warranty of any kind, whether express or implied. */ +#include #include #include #include @@ -43,20 +44,20 @@ #define PCA9541_CONTROL 0x01 #define PCA9541_ISTAT 0x02 -#define PCA9541_CTL_MYBUS (1 << 0) -#define PCA9541_CTL_NMYBUS (1 << 1) -#define PCA9541_CTL_BUSON (1 << 2) -#define PCA9541_CTL_NBUSON (1 << 3) -#define PCA9541_CTL_BUSINIT (1 << 4) -#define PCA9541_CTL_TESTON (1 << 6) -#define PCA9541_CTL_NTESTON (1 << 7) - -#define PCA9541_ISTAT_INTIN (1 << 0) -#define PCA9541_ISTAT_BUSINIT (1 << 1) -#define PCA9541_ISTAT_BUSOK (1 << 2) -#define PCA9541_ISTAT_BUSLOST (1 << 3) -#define PCA9541_ISTAT_MYTEST (1 << 6) -#define PCA9541_ISTAT_NMYTEST (1 << 7) +#define PCA9541_CTL_MYBUS BIT(0) +#define PCA9541_CTL_NMYBUS BIT(1) +#define PCA9541_CTL_BUSON BIT(2) +#define PCA9541_CTL_NBUSON BIT(3) +#define PCA9541_CTL_BUSINIT BIT(4) +#define PCA9541_CTL_TESTON BIT(6) +#define PCA9541_CTL_NTESTON BIT(7) + +#define PCA9541_ISTAT_INTIN BIT(0) +#define PCA9541_ISTAT_BUSINIT BIT(1) +#define PCA9541_ISTAT_BUSOK BIT(2) +#define PCA9541_ISTAT_BUSLOST BIT(3) +#define PCA9541_ISTAT_MYTEST BIT(6) +#define PCA9541_ISTAT_NMYTEST BIT(7) #define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) #define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) From patchwork Wed Mar 6 23:15:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 1052562 X-Patchwork-Delegate: patchwork@peda.user.lysator.liu.se Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axentia.se Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=axentia.se header.i=@axentia.se header.b="vvCUg/Ck"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44F8lP4wnmz9s4Y for ; Thu, 7 Mar 2019 10:16:17 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726111AbfCFXQQ (ORCPT ); Wed, 6 Mar 2019 18:16:16 -0500 Received: from mail-eopbgr80112.outbound.protection.outlook.com ([40.107.8.112]:32096 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726094AbfCFXQQ (ORCPT ); Wed, 6 Mar 2019 18:16:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mx/ZUJJcV5bKpqYM0JorZEm8e/d3rIsWW11+6NuiM/8=; b=vvCUg/CkI/i9ur8NNftnr5E3mW3u3B/tpNsxMMD7KCeiJ3DvPyje7NXGqE8OhHtt7NASvPcQSO5Wp2In9dwqknH2/vFnQetzbHC+LJGFjkp0gCD5SwEsoXp2JIgP8zKRn2fGfgsrQGtKq3uaAMkRBF6quqBVXC1bBCl0l5o6N+w= Received: from VI1PR02MB4542.eurprd02.prod.outlook.com (20.178.12.74) by VI1PR02MB4592.eurprd02.prod.outlook.com (20.178.12.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 23:15:40 +0000 Received: from VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1]) by VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 23:15:40 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Rob Herring , Mark Rutland , Guenter Roeck , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , Ken Chen , Pradeep Srinivasan Subject: [PATCH v2 2/5] i2c: mux: pca9541: namespace cleanup Thread-Topic: [PATCH v2 2/5] i2c: mux: pca9541: namespace cleanup Thread-Index: AQHU1HKDiruWDOCBzkKteDPj/UtePQ== Date: Wed, 6 Mar 2019 23:15:40 +0000 Message-ID: <20190306231521.29367-3-peda@axentia.se> References: <20190306231521.29367-1-peda@axentia.se> In-Reply-To: <20190306231521.29367-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR1001CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::26) To VI1PR02MB4542.eurprd02.prod.outlook.com (2603:10a6:803:b1::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 39f46349-1ec2-451d-8bde-08d6a289a64e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:VI1PR02MB4592; x-ms-traffictypediagnostic: VI1PR02MB4592: x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39830400003)(396003)(366004)(346002)(136003)(189003)(199004)(5640700003)(53936002)(6486002)(71200400001)(6436002)(2501003)(71190400001)(99286004)(4326008)(6916009)(476003)(102836004)(76176011)(256004)(446003)(486006)(52116002)(3846002)(86362001)(386003)(74482002)(6506007)(6512007)(26005)(6116002)(97736004)(66066001)(305945005)(7736002)(2351001)(186003)(2616005)(14444005)(11346002)(25786009)(106356001)(36756003)(8936002)(8676002)(68736007)(81156014)(81166006)(5660300002)(508600001)(2906002)(54906003)(1076003)(50226002)(316002)(14454004)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB4592; H:VI1PR02MB4542.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR02MB4592=3B23?= =?iso-8859-1?q?=3ABEt8TLa4cKrfuvPp+aUxLsPci9fc5nBH7I+doM/O4Bw7+RAg?= =?iso-8859-1?q?49873Z/5ujmaqMMgWT2rGwr352EWz3jI30Ix9GeEHEWuzXM/i5q?= =?iso-8859-1?q?NTG8EElUJXpvGq+IWVfGpZ/Z4GLjkidbiOmpf3jgSo/mmDsKa1n?= =?iso-8859-1?q?AX5gVW9/Hh8PKb0+cQ74werlbctKuXalmDwz+O5OTnWI5UFEgn/?= =?iso-8859-1?q?eE8Pqwad8L0H+/8Fe5SS9tQ07brVfLeaPXso+aSA8HRdmKdm5wo?= =?iso-8859-1?q?l03CHR4YQa8ZApQu3PG6PdUWgTNyOSvFQYXbX3OTPYBA+lyTimy?= =?iso-8859-1?q?++QPi/i7Y5nyRulUFpxG/Dk1bGp4AJUrw/okuRw9sOMdJbLnx2S?= =?iso-8859-1?q?eumkW6k8LRdPO72fcQrt+R3lL6ZXpv5d69I7Y5UuNtm954nxAbI?= =?iso-8859-1?q?OYp397BRJT159znZ75LX93u89iC5wXjtbUlCqFiyIwk+TivblYQ?= =?iso-8859-1?q?tS7tFnijMxU5pTdfwN80q9YJfD8KghBk5bORC+gLK+K1x8kvxPa?= =?iso-8859-1?q?jSQNgUfs4Roorpeiq6F+kx/1kRSQtHSdf5BaVylhC0nzUOHYz+5?= =?iso-8859-1?q?sGh8MMcUxIaC4wKH60VrR8T/cn8erDB8yu2FAx1dZ0sPQntgvez?= =?iso-8859-1?q?B+7hF3hi7fwznR0hzB/RvHAB9WaUxQbNPChQe7Udtv2I8ZIFDbw?= =?iso-8859-1?q?xoLKfX5M3NVwCqanpcrvj8Q8QktgmlB0BxFeNNemJGBwJ/W77Yv?= =?iso-8859-1?q?Za8i9FXKloI7IkPJLMW5eKsoNJPi1hD4yeFGrsrCal3aW4z9oLn?= =?iso-8859-1?q?lD9gYNUJ40gfFlh6lNfTEq9VE2lF3OlmGvpZJNcLQtHjkGwIMB1?= =?iso-8859-1?q?5ULahfolejDmmSmS2UJ6IDIGHszsiQblamaWsLDFIq0UovVLyE2?= =?iso-8859-1?q?skYwlkWb7mjylqjlfcXTrPxnfz4NN7qiZcCFUcNQRjHZ8HrrgDD?= =?iso-8859-1?q?ci7r7PJ8eugFJdI/po6v78I4PPnL1LfTLoWyZN4LyyyFJrJfslt?= =?iso-8859-1?q?85qAMESmwqkZHfh9xBX2qnBGaIUM6pkChInUJKgmBZ9GKRVRZxc?= =?iso-8859-1?q?9gjlqdccmFMPDFZU9lgDFMLK48vhjvBbfuy9qZb3XBYRmf20cTa?= =?iso-8859-1?q?QvgihNk4Ti4lET0lc7AP5eoliHrezRvV8JlJ+n1bylHp7+HR3qF?= =?iso-8859-1?q?weuXlORlp7Hf3ewc/DJvOVo5H0YVAAaCd84dmnzlp3su95N5ihY?= =?iso-8859-1?q?BFr9Blrn7PrW66MS1ZbdDDcspHuGBFhBKptBcQ5kEmudS3QI1z1?= =?iso-8859-1?q?/Dkhy/NvHD3cZSIcULhCkttuTq7jeePxSAb4n0VaBgCAJ4BJ0Jy?= =?iso-8859-1?q?eBsNfUx7lc5qv9MTaLRhPfK3qmjIcmN6s7F1Ccy6+pufCgExx6I?= =?iso-8859-1?q?=3D?= x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 7ZE/AuvOggjpSME/jfWd1szh4aeKqYHv+cpL1Peg/Tuc6UuwJQM88KiZn0c6kYYPJrhJxslalw5k87Yw01NUS9OcYcxW3y1hWfU0kIqEdx+fvXAeDn+som5AyyWLB4Sb2E7Bv7z+ZrJPzUNi8cAiP0cvAeWzVo78FJagW73UetlHNlHcp2DFvcigpmKcrOUCQnldWCGOnAsNuoB8syIPxXFb3rV+ruPcdnIxldtrUrMIHRk8vSiRXdTJWSk7VBQfrZEiegdaP3Be8BU085tSVIJ5RX2PTIDw3UerGrMMSAAIozU12NGZhF4jAEOujUmm455RQaj1gWZ0Xa2N6qaFSpVm7JxTW6PeyPiUJbd85Dth1eH5R1Kku3Hi/ZBkUVJipWW+pvU4K0C14o75QBQNKowiWqeNrObwyalKY2OvTr0= MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 39f46349-1ec2-451d-8bde-08d6a289a64e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 23:15:40.5379 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB4592 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org In preparation for PCA9641 support, convert the mybus and busoff macros to functions, and in the process prefix them with pca9541_. Also prefix remaining chip specific macros with PCA9541_. Reviewed-by: Vladimir Zapolskiy Reviewed-by: Guenter Roeck Signed-off-by: Peter Rosin --- drivers/i2c/muxes/i2c-mux-pca9541.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index 30cabf482985..28f46450f4b4 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c @@ -59,10 +59,8 @@ #define PCA9541_ISTAT_MYTEST BIT(6) #define PCA9541_ISTAT_NMYTEST BIT(7) -#define BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) -#define MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) -#define mybus(x) (!((x) & MYBUS) || ((x) & MYBUS) == MYBUS) -#define busoff(x) (!((x) & BUSON) || ((x) & BUSON) == BUSON) +#define PCA9541_BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) +#define PCA9541_MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) /* arbitration timeouts, in jiffies */ #define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ @@ -93,6 +91,20 @@ static const struct of_device_id pca9541_of_match[] = { MODULE_DEVICE_TABLE(of, pca9541_of_match); #endif +static bool pca9541_mybus(int ctl) +{ + if (!(ctl & PCA9541_MYBUS)) + return true; + return (ctl & PCA9541_MYBUS) == PCA9541_MYBUS; +} + +static bool pca9541_busoff(int ctl) +{ + if (!(ctl & PCA9541_BUSON)) + return true; + return (ctl & PCA9541_BUSON) == PCA9541_BUSON; +} + /* * Write to chip register. Don't use i2c_transfer()/i2c_smbus_xfer() * as they will try to lock the adapter a second time. @@ -134,7 +146,7 @@ static void pca9541_release_bus(struct i2c_client *client) int reg; reg = pca9541_reg_read(client, PCA9541_CONTROL); - if (reg >= 0 && !busoff(reg) && mybus(reg)) + if (reg >= 0 && !pca9541_busoff(reg) && pca9541_mybus(reg)) pca9541_reg_write(client, PCA9541_CONTROL, (reg & PCA9541_CTL_NBUSON) >> 1); } @@ -186,7 +198,7 @@ static int pca9541_arbitrate(struct i2c_client *client) if (reg < 0) return reg; - if (busoff(reg)) { + if (pca9541_busoff(reg)) { int istat; /* * Bus is off. Request ownership or turn it on unless @@ -211,7 +223,7 @@ static int pca9541_arbitrate(struct i2c_client *client) */ data->select_timeout = SELECT_DELAY_LONG * 2; } - } else if (mybus(reg)) { + } else if (pca9541_mybus(reg)) { /* * Bus is on, and we own it. We are done with acquisition. * Reset NTESTON and BUSINIT, then return success. From patchwork Wed Mar 6 23:15:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 1052567 X-Patchwork-Delegate: patchwork@peda.user.lysator.liu.se Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axentia.se Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=axentia.se header.i=@axentia.se header.b="GHPFp6su"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44F8lv5wM2z9s7T for ; Thu, 7 Mar 2019 10:16:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726311AbfCFXQT (ORCPT ); Wed, 6 Mar 2019 18:16:19 -0500 Received: from mail-eopbgr80112.outbound.protection.outlook.com ([40.107.8.112]:32096 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726028AbfCFXQS (ORCPT ); Wed, 6 Mar 2019 18:16:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qEDsSkcy2Dl+pZMj925hy09I5tHTZNUpLAFoVOaWT7E=; b=GHPFp6su/WADVz5MJQaQEtJsnAEAFCiGqgz/Xd54+TjuDm3hzf0RiIYvgBEepZMtUCLSqJ+srYJbBuFegJweZ8WfqZvfex78wNOJOejiyAIWJ/C50p/Qn5KwfVspfiboFRkvd3Kxwpr5RjnxLTx+24aE9I/nvgwGwy9qQEaXEP8= Received: from VI1PR02MB4542.eurprd02.prod.outlook.com (20.178.12.74) by VI1PR02MB4592.eurprd02.prod.outlook.com (20.178.12.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 23:15:46 +0000 Received: from VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1]) by VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 23:15:46 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Rob Herring , Mark Rutland , Guenter Roeck , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , Ken Chen , Pradeep Srinivasan Subject: [PATCH v2 3/5] i2c: mux: pca9541: prepare for PCA9641 support Thread-Topic: [PATCH v2 3/5] i2c: mux: pca9541: prepare for PCA9641 support Thread-Index: AQHU1HKH44/iJB6yF0CBwnJOj23PjQ== Date: Wed, 6 Mar 2019 23:15:45 +0000 Message-ID: <20190306231521.29367-4-peda@axentia.se> References: <20190306231521.29367-1-peda@axentia.se> In-Reply-To: <20190306231521.29367-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR1001CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::26) To VI1PR02MB4542.eurprd02.prod.outlook.com (2603:10a6:803:b1::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 115f7e9d-4c7b-4635-9a82-08d6a289a98a x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:VI1PR02MB4592; x-ms-traffictypediagnostic: VI1PR02MB4592: x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(39830400003)(396003)(366004)(346002)(136003)(189003)(199004)(5640700003)(53936002)(6486002)(71200400001)(6436002)(2501003)(71190400001)(99286004)(4326008)(6916009)(476003)(102836004)(76176011)(256004)(446003)(486006)(52116002)(3846002)(86362001)(386003)(74482002)(6506007)(6512007)(26005)(6116002)(97736004)(66066001)(305945005)(7736002)(2351001)(186003)(2616005)(14444005)(11346002)(25786009)(106356001)(36756003)(8936002)(8676002)(68736007)(81156014)(81166006)(5660300002)(508600001)(2906002)(54906003)(1076003)(50226002)(316002)(14454004)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB4592; H:VI1PR02MB4542.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR02MB4592=3B23?= =?iso-8859-1?q?=3A6jdWfkUmVI0r0ow5QOOAXc0ve/ZbxajTwtYC8tI/7Bo+pSPV?= =?iso-8859-1?q?ehhZHvzwGKIBj7ElgMloC55LM1ZNpH02Z1cNo9GGdBiCnTaJA+r?= =?iso-8859-1?q?aFM2iNdSUgKiaZqLszTTBP5dEovZBXvyCh0WjzQq7dUvesNSh1o?= =?iso-8859-1?q?3hEHGB7u2W3Fr7YYGYD7UF4fTBsXgbRS1ycIGihD9bKUp5VHsFV?= =?iso-8859-1?q?m7P/ZfXetSzhIwlirXW3f86VsTIr12qVP/dMRVkODU5OtXrBPIc?= =?iso-8859-1?q?JurUxQZK6mKOfqfeoY8Syfe1+BXrS5gIa757YOLGvpD7Jno4s+x?= =?iso-8859-1?q?22EfHtI9EpvBfr+zsKD+bD9i07q187FQFkA29c6MD03BR6KzF9a?= =?iso-8859-1?q?3CuD7nIjErNzY1ec8vD8nfopB/dNG+w0TEBRhaS+gGp4XGm6pHj?= =?iso-8859-1?q?+gRPvYlnPbnlK30/sa57ESmyJJO6tG+AWVrURjFsArTwZUxBVE1?= =?iso-8859-1?q?sWnIHFeyBBLMkfy0Nav1A1OjUyMsLUP2689bMbNHBHB+Byvn/Qo?= =?iso-8859-1?q?j4+0txqmajmN9u+MkiyOltKv7T0jYGUZFGrSW0QOhNJ7F6TF7iI?= =?iso-8859-1?q?RiKnVVeNhcVlfMmmmCxHSRwmHwgF/n8fHJIyF1nlQufz178mVi5?= =?iso-8859-1?q?zF9fCIkTGOa+/aawSqgRDiSsFYi6LIRJY1sUXEWWF/GiWlPGeMy?= =?iso-8859-1?q?feAI9kXKneaZo7scz5/yikmyuveWttiV+8R1lCvbJjVMLSr3evW?= =?iso-8859-1?q?2k6fU3bciVojCwvLLd+53e0bcdl9hrJ0yoJHKouZzMR4eYekIFo?= =?iso-8859-1?q?Q86ApvkT8SEKzIuWjXUDoj6WLYQ5O+1gGbtgMOmWozpInYUx5Ax?= =?iso-8859-1?q?iT/QJMYNa9RttmOgp/NKjUhBvxtR+UoJhcAtwZIPBSL64XxzLxH?= =?iso-8859-1?q?rBLVgPgG0t7aX1bpUw9iDy/BOltzm2wSzuKPJ08Un7zL39fdweJ?= =?iso-8859-1?q?OXYJ+SFlsuslTVW+NSuOYHkqjhHS2zH7+MkJsjVsgJHoBH/5c6+?= =?iso-8859-1?q?CAaqoemoz4gN8gnin15Rr+HXFOGN6reH4pVizKqZHZLrDkxkxIc?= =?iso-8859-1?q?zGr57N6N1RY9HujB0wh5hmXQDzm6c4BDGgkFfltvVlwikZfBn5G?= =?iso-8859-1?q?dxRkA+pnvc8nGJDXWXGr59Stxb1JAiX/oIKuHJ8iCY7utD67eQa?= =?iso-8859-1?q?JOA3PmxuBJUTlPCqdjGhRIDzUUmVPvDGoynPJN0z3eI8B4Yl2Hm?= =?iso-8859-1?q?zNJeHYIh0KFF88IdtunaFJXyFQ+CXV+cHe0ua9arVgZP9Q+HDdr?= =?iso-8859-1?q?DOJLTDEAveuG3SqjB1RP4/NOdi3yf0Lte5zVJw400eS0oAsFS3K?= =?iso-8859-1?q?5DtzkyX8w7RAgYZD0mebAx4FmZGRgahwE8csS6upccob4ZyqOPQ?= =?iso-8859-1?q?=3D?= x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: KiN0cHHlCCcK/GIOOWWh1mOMJ+dFxzbsA4IpWQwfcizwxKAcL5Fo8mtcoBRHQoTTiszucWawI3VGQcawrbpt9vr2rAgBSSbrRLAr+M79hIMGlc2XP9I6vXr8neoZ77GqtQbl/36APQq+qJloA/dUXgA+e2Re2yy9fz+GvtpVpq77S9cBRXhrcxx7oS5hlyNThYWFXkjdS8CDAKuHxXVljVjUYxPlIIwUScMvPPL/b45ooGPaGFzT3iz8/gF4LX9dCGALGoRJQeShTQyaKtCurIuXNwJgbjH5RbxGh162qNMR5bqG7yyy2lh4KyL5AQwWjZWnss9CjQWX72h6AOQAiwRk1UA1bHBBVUg7l52zA6KEfE1vs/uLKDhRLQ573ZAn1qHHAJ+FGXliOCcxfTGqaXoIpV+SjOqtp6xg7h8g1TA= MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 115f7e9d-4c7b-4635-9a82-08d6a289a98a X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 23:15:45.9947 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB4592 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Make the arbitrate and release_bus implementation chip specific. Reviewed-by: Guenter Roeck Reviewed-by: Vladimir Zapolskiy Signed-off-by: Peter Rosin --- drivers/i2c/muxes/i2c-mux-pca9541.c | 62 +++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index 28f46450f4b4..5eb36e3223d5 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -70,26 +71,22 @@ #define SELECT_DELAY_SHORT 50 #define SELECT_DELAY_LONG 1000 -struct pca9541 { - struct i2c_client *client; - unsigned long select_timeout; - unsigned long arb_timeout; +enum chip_name { + pca9541, }; -static const struct i2c_device_id pca9541_id[] = { - {"pca9541", 0}, - {} +struct chip_desc { + int (*arbitrate)(struct i2c_client *client); + void (*release_bus)(struct i2c_client *client); }; -MODULE_DEVICE_TABLE(i2c, pca9541_id); +struct pca9541 { + const struct chip_desc *chip; -#ifdef CONFIG_OF -static const struct of_device_id pca9541_of_match[] = { - { .compatible = "nxp,pca9541" }, - {} + struct i2c_client *client; + unsigned long select_timeout; + unsigned long arb_timeout; }; -MODULE_DEVICE_TABLE(of, pca9541_of_match); -#endif static bool pca9541_mybus(int ctl) { @@ -271,7 +268,7 @@ static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan) /* force bus ownership after this time */ do { - ret = pca9541_arbitrate(client); + ret = data->chip->arbitrate(client); if (ret) return ret < 0 ? ret : 0; @@ -289,10 +286,32 @@ static int pca9541_release_chan(struct i2c_mux_core *muxc, u32 chan) struct pca9541 *data = i2c_mux_priv(muxc); struct i2c_client *client = data->client; - pca9541_release_bus(client); + data->chip->release_bus(client); return 0; } +static const struct chip_desc chips[] = { + [pca9541] = { + .arbitrate = pca9541_arbitrate, + .release_bus = pca9541_release_bus, + }, +}; + +static const struct i2c_device_id pca9541_id[] = { + { "pca9541", pca9541 }, + {} +}; + +MODULE_DEVICE_TABLE(i2c, pca9541_id); + +#ifdef CONFIG_OF +static const struct of_device_id pca9541_of_match[] = { + { .compatible = "nxp,pca9541", .data = &chips[pca9541] }, + {} +}; +MODULE_DEVICE_TABLE(of, pca9541_of_match); +#endif + /* * I2C init/probing/exit functions */ @@ -301,6 +320,8 @@ static int pca9541_probe(struct i2c_client *client, { struct i2c_adapter *adap = client->adapter; struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); + const struct of_device_id *match; + const struct chip_desc *chip; struct i2c_mux_core *muxc; struct pca9541 *data; int force; @@ -309,12 +330,18 @@ static int pca9541_probe(struct i2c_client *client, if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; + match = of_match_device(of_match_ptr(pca9541_of_match), &client->dev); + if (match) + chip = of_device_get_match_data(&client->dev); + else + chip = &chips[id->driver_data]; + /* * I2C accesses are unprotected here. * We have to lock the I2C segment before releasing the bus. */ i2c_lock_bus(adap, I2C_LOCK_SEGMENT); - pca9541_release_bus(client); + chip->release_bus(client); i2c_unlock_bus(adap, I2C_LOCK_SEGMENT); /* Create mux adapter */ @@ -329,6 +356,7 @@ static int pca9541_probe(struct i2c_client *client, return -ENOMEM; data = i2c_mux_priv(muxc); + data->chip = chip; data->client = client; i2c_set_clientdata(client, muxc); From patchwork Wed Mar 6 23:15:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 1052564 X-Patchwork-Delegate: patchwork@peda.user.lysator.liu.se Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axentia.se Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=axentia.se header.i=@axentia.se header.b="nKad1hKh"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44F8lj4kpJz9s4Y for ; Thu, 7 Mar 2019 10:16:33 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726268AbfCFXQX (ORCPT ); Wed, 6 Mar 2019 18:16:23 -0500 Received: from mail-eopbgr80112.outbound.protection.outlook.com ([40.107.8.112]:32096 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726094AbfCFXQU (ORCPT ); Wed, 6 Mar 2019 18:16:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p//tVxMFQGuR2Ph88SW+yEwAvcpnaNHEyj9vdDTKGTw=; b=nKad1hKhYFmgfDeQEyukY5hYe3KAAJTYRa6NIGbNxsJazNy/XcsNJaWuHPp7gz+9shTUl/muF7NuuQOrJKoTEqp6ytpaaC+tA08l1m57zfOQ2xrM/7bDDi3BzC/EOUwfizyuOwN0k+aWD99kONAXqAjRYr3wrMqC0UymxbVXNmo= Received: from VI1PR02MB4542.eurprd02.prod.outlook.com (20.178.12.74) by VI1PR02MB4592.eurprd02.prod.outlook.com (20.178.12.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 23:15:51 +0000 Received: from VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1]) by VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 23:15:51 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Rob Herring , Mark Rutland , Guenter Roeck , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , Ken Chen , Pradeep Srinivasan Subject: [PATCH v2 4/5] dt-bindings: i2c: pca9541: extend with compatible for PCA9641 Thread-Topic: [PATCH v2 4/5] dt-bindings: i2c: pca9541: extend with compatible for PCA9641 Thread-Index: AQHU1HKKVkVlIpSgmk6zf8PZhXb1zw== Date: Wed, 6 Mar 2019 23:15:50 +0000 Message-ID: <20190306231521.29367-5-peda@axentia.se> References: <20190306231521.29367-1-peda@axentia.se> In-Reply-To: <20190306231521.29367-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR1001CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::26) To VI1PR02MB4542.eurprd02.prod.outlook.com (2603:10a6:803:b1::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a8aa5df9-e3ac-4f94-e8bb-08d6a289ac7c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:VI1PR02MB4592; x-ms-traffictypediagnostic: VI1PR02MB4592: x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(396003)(366004)(346002)(136003)(39840400004)(189003)(199004)(5640700003)(53936002)(6486002)(71200400001)(6436002)(2501003)(71190400001)(99286004)(4326008)(6916009)(476003)(102836004)(76176011)(256004)(446003)(486006)(52116002)(3846002)(86362001)(386003)(74482002)(6506007)(6512007)(26005)(6116002)(97736004)(66066001)(305945005)(7736002)(2351001)(186003)(2616005)(11346002)(25786009)(106356001)(36756003)(8936002)(8676002)(68736007)(81156014)(81166006)(5660300002)(508600001)(2906002)(54906003)(1076003)(4744005)(50226002)(316002)(14454004)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB4592; H:VI1PR02MB4542.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR02MB4592=3B23?= =?iso-8859-1?q?=3A/7jmNrbJxRotkWj6yKWysOIAnyy+0Lig96r4bcJhgD30ZTUs?= =?iso-8859-1?q?d5PHdhMFe3RaMdIT9428IC19IgPd8+2SsKzUIJ0gd52SPlfIJdP?= =?iso-8859-1?q?gqKRvU1eWYoQXsdaLJPdzvTHbJl4Xm0BQWE/7LKL+ji8w8j4e8W?= =?iso-8859-1?q?F4JT1o7WUutAeXjPEJWm9H0SfmHA8qG/N9Sipr6IVIf9vF3c0V+?= =?iso-8859-1?q?vNrL3EWJfPqVtikSR6wWQTQkfhoPwJR5hwokuyq/KbKIfwm14WN?= =?iso-8859-1?q?SyMOihmBBU9lIjUAmW64W/zYa/xMi5NZPUNqccQjHsl9PAR89L9?= =?iso-8859-1?q?QiQJyJqBK8slDgsBUeOASTmVBlSJCYWn33fRmV6XApC9ZbE7eEK?= =?iso-8859-1?q?Kca2c6qnk0UhWKC0+tA829JTJOrq5DuBIA3hwXjfWSoZsmwEuAf?= =?iso-8859-1?q?W7hdZzC0mf4Gzu/b7Z6bsq+eUNa7+HtkRwlQ5ennXF9sU9KF1lZ?= =?iso-8859-1?q?JgFtz5kjrBnu99Z+xowCZmtQOnl47sguvf0gByzeZTGRktoTrFp?= =?iso-8859-1?q?U/kH8CD5af2kbaFCtyrtsRrQJgApP6eDjIo5tdxCcvebcsswtU5?= =?iso-8859-1?q?ObF8VKzDO9bt0v9i7IQwE7xNOH8ip+soyxKvCY0yRIO9OmvLsYo?= =?iso-8859-1?q?7ruAs2Chu2ZQdq1M9teePTP1V66QXqij0tbdNiJLof0bauKC3GO?= =?iso-8859-1?q?dAz16kPhNFkXFa5LS8gtQKB4D0KaH6LHfGo3gglKqDDNQdIZYXO?= =?iso-8859-1?q?mJYCdBdqJtLjmUCReD5NwE1U2jeRFaCJessLl+AiyCCC8tA6wyi?= =?iso-8859-1?q?uLlFgQjnPK3jjtYIzJ2+YIJiBPe6p/yVIHFFFj+iVO2QNuMls4R?= =?iso-8859-1?q?AD+qZ9s02Zbg0ijBf9qRkK0OuMkezbjGLkzJvmAFssoyYKVRlmQ?= =?iso-8859-1?q?5+9wubJFRGhgFhsPckGcrpxIvSs+LgVitHcJSJEEuqebKF8P2fD?= =?iso-8859-1?q?SMSPXGEYGVA3y+TFX77su+KY7r56a9MGgaccYJ1JGoZB6FerWO6?= =?iso-8859-1?q?BouQedQGjIrSK4YCebknfMfhUcrWeYjbpiPJXQXCk52/ejl/axW?= =?iso-8859-1?q?JU3ABN1SFbZvpxsi1nySr/xWGdXMKEyv4zIw7JctXY7brC4r0Mi?= =?iso-8859-1?q?SHOQSrNN7bG+hvWp8AkMtNUEh6lCyNei55/Xm8UfDTXxSEIyrKd?= =?iso-8859-1?q?9wCShxe1cPcr+erIhZCVBKQl3STYFbemsqYoYwmZzmrzkNacS9v?= =?iso-8859-1?q?1jDJE3uhbv5KXQoK51+uECjuME4kFIOTGsMT8wKmSaSA277wkHA?= =?iso-8859-1?q?tpMhRvRSrrMoq0mNXjpOE8JWuXzh+g6nha00jVqQx2EjwRb8dOf?= =?iso-8859-1?q?f/e2iCqb16OEE2454kSAiLHhbDVi2qGwS72Nhl+UVQQKlRin1AM?= =?iso-8859-1?q?=3D?= x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: d8JFAe71BuYRXnGY0lC5af2yubcohMityEaoKnNhnsB6CTDiAj+DHxFvJtLZVRV8LTZxw0DJP4niBXsy3Lz2fLINuaWIhJi8EXQgJHBFHNlcfNfI60o6jEU7ROO5E2Bv29Evz17ur/+AdfMo7bxTUgqWq2Ups/alLfapXc1Cq+nfASquMkxHNuzbV2WQ02MwmkCCGi3l13NWkxQxuC2uMd9Q1BKou/hbnTc+PSPpaD6YNWnr1NMQzX8RPP7UG4HYOTENT9kjVlxMQKG8Csvdpf1Jrh6dmTNEF0Mzc+U4dlrq9pnG6y4lbxNIYkCUyaZTbS2KsFm30vrJmRKMZ6QWe7a43uTd5h0sE7jWaMAi5Q3eW54TkaQCZvltyvmtZ5FfZQPaTj92LEcHUGgBA2BDJ+zUTv3SHFFE7n3B1h/B8YA= MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: a8aa5df9-e3ac-4f94-e8bb-08d6a289ac7c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 23:15:51.0222 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB4592 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The binding is equivalent apart from the compatible. Signed-off-by: Peter Rosin Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/i2c/nxp,pca9541.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/nxp,pca9541.txt b/Documentation/devicetree/bindings/i2c/nxp,pca9541.txt index 42bfc09c8918..17b4cb9d76da 100644 --- a/Documentation/devicetree/bindings/i2c/nxp,pca9541.txt +++ b/Documentation/devicetree/bindings/i2c/nxp,pca9541.txt @@ -1,8 +1,10 @@ -* NXP PCA9541 I2C bus master selector +* NXP PCA9541/PCA9641 I2C bus master selectors Required Properties: - - compatible: Must be "nxp,pca9541" + - compatible: Must be either of + "nxp,pca9541" + "nxp,pca9641" - reg: The I2C address of the device. From patchwork Wed Mar 6 23:15:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 1052563 X-Patchwork-Delegate: patchwork@peda.user.lysator.liu.se Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=axentia.se Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=axentia.se header.i=@axentia.se header.b="Z6WIb6Kk"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44F8lf60jlz9sCJ for ; Thu, 7 Mar 2019 10:16:30 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726094AbfCFXQY (ORCPT ); Wed, 6 Mar 2019 18:16:24 -0500 Received: from mail-eopbgr80112.outbound.protection.outlook.com ([40.107.8.112]:32096 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726342AbfCFXQX (ORCPT ); Wed, 6 Mar 2019 18:16:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EkezuVihIiF/SGNm0FgndOUpv8T1hma6KrgXxfNDKJY=; b=Z6WIb6Kk36I6V5qeA7TZjbP8bA0ZzrH7vukDUzka/MHmAuyJ5Ul1+XpWsZPrTS6DhA5Sd/31CSM4Xt9El6bvLylLHPlZ2oQtiL9dVv8xTamuSqCPoUa2ZbEA3vqr9S/1zH0fe732zJtOWy2x/iJUHRjvkjmEkCyYLaYlG9MzMx0= Received: from VI1PR02MB4542.eurprd02.prod.outlook.com (20.178.12.74) by VI1PR02MB4592.eurprd02.prod.outlook.com (20.178.12.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.19; Wed, 6 Mar 2019 23:15:56 +0000 Received: from VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1]) by VI1PR02MB4542.eurprd02.prod.outlook.com ([fe80::38db:37eb:b43e:e4c1%6]) with mapi id 15.20.1665.020; Wed, 6 Mar 2019 23:15:56 +0000 From: Peter Rosin To: "linux-kernel@vger.kernel.org" CC: Peter Rosin , Rob Herring , Mark Rutland , Guenter Roeck , "linux-i2c@vger.kernel.org" , "devicetree@vger.kernel.org" , Ken Chen , Pradeep Srinivasan Subject: [PATCH v2 5/5] i2c: mux: pca9541: add support for PCA9641 Thread-Topic: [PATCH v2 5/5] i2c: mux: pca9541: add support for PCA9641 Thread-Index: AQHU1HKNjSK6x+/IzUatPrdqzggr/g== Date: Wed, 6 Mar 2019 23:15:56 +0000 Message-ID: <20190306231521.29367-6-peda@axentia.se> References: <20190306231521.29367-1-peda@axentia.se> In-Reply-To: <20190306231521.29367-1-peda@axentia.se> Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.11.0 x-originating-ip: [85.226.244.23] x-clientproxiedby: HE1PR1001CA0016.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:3:f7::26) To VI1PR02MB4542.eurprd02.prod.outlook.com (2603:10a6:803:b1::10) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 56759a6e-cab9-4598-af7b-08d6a289af8c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:VI1PR02MB4592; x-ms-traffictypediagnostic: VI1PR02MB4592: x-microsoft-antispam-prvs: x-forefront-prvs: 0968D37274 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(396003)(366004)(346002)(136003)(39840400004)(189003)(199004)(5640700003)(53936002)(6486002)(71200400001)(6436002)(2501003)(71190400001)(99286004)(4326008)(6916009)(476003)(102836004)(76176011)(256004)(446003)(486006)(52116002)(3846002)(86362001)(386003)(74482002)(6506007)(6512007)(26005)(6116002)(97736004)(66066001)(305945005)(7736002)(2351001)(186003)(2616005)(14444005)(11346002)(25786009)(106356001)(36756003)(8936002)(8676002)(68736007)(81156014)(81166006)(5660300002)(508600001)(2906002)(54906003)(1076003)(50226002)(316002)(14454004)(105586002)(13158425004); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR02MB4592; H:VI1PR02MB4542.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BVI1PR02MB4592=3B23?= =?iso-8859-1?q?=3AbHOiRmPX8rE7fkuHVGAnr9cwtTYvRywPgJ7WR0Y+0aDezxTb?= =?iso-8859-1?q?AgbQjXBL0wMQCgaX3oHVEDzJ8AmaXbF+TA01p8LoucijVqUw4Lv?= =?iso-8859-1?q?SCk3RAUaP4cQ2bthaHH5kcV9fZLR5WYGEZ8yQBIxMrh4U34TiDt?= =?iso-8859-1?q?o4jsig3tcfLqvdtI0B1MxsweT6JnvTs19lJ/FHv5JCxdrs/efA6?= =?iso-8859-1?q?s9Vb/YSbBb/2XvOhUDawzFNkFyn1oHBfvl0QP1fFoQ4YdOvyPbG?= =?iso-8859-1?q?nnbqnWTE+uccC60qKDr6XY/OKAiUGmIlcMubBTAl6H52siaxoR8?= =?iso-8859-1?q?FiOgc3o3ztIb4oAdW+SnNbSQmX2zegIA2a9f+AMKGtVj00p0+bZ?= =?iso-8859-1?q?4kYLknGcH+SdwFOqGRH9sw54cf7C1wGYJxwP+kcpYiUzsMnMDNP?= =?iso-8859-1?q?a5OuD+nThk0xbkGg/bGWlqtDZSlFtSOzNGehzoCsUIRV/IzYWyW?= =?iso-8859-1?q?DbRplEkZpRpwqL15KFlRm8Ifd5wa20eeqJTzOElykxp0uxym1Mw?= =?iso-8859-1?q?2kRN+xfrFD7Pjm+GIaALQmWv970ft5fMslO15B6HDvDSZfCrQ7+?= =?iso-8859-1?q?hZVZY2Wl7qb1RMLj9t37VyMLsNWMxHKK42z6MiOqiuXzoqzrIhi?= =?iso-8859-1?q?gYyO5EkpkGfFZu38FLrE3t609rRMvArJ8/PTXEdiLL/m9GbpnvV?= =?iso-8859-1?q?NVg9RCac4NRESaVSRdxxA8DD5gSIbjtNMKPPmILts2vrGe3c1wJ?= =?iso-8859-1?q?Dn1Yk0z3WU861ZX2jvEGa2wyEBuZ7zYgMgywsCmzU0wGNHQ5CB3?= =?iso-8859-1?q?DPjZeJcPK04olhNXQH3Ngg5JzMBZVrS+lEtd7wNk/9fV8lGSUdx?= =?iso-8859-1?q?PsK3LwbIpt+k4CU2X6k36Qf7uMPtFRBXPUaBs9eEyAio+zzwrUq?= =?iso-8859-1?q?PqKkwAU4ioBKVE2olPyiuhqMqoGMDur4eh5QBZXO4ciKlsUOsis?= =?iso-8859-1?q?4jJQziPBraJJVc25bW4v9DABG8sjyAsD+Sh4AKrsTCPlOBdpv50?= =?iso-8859-1?q?/SKUsRoCj0WCLPbGzpFR4oEfJ37c52n2QJIOqIWAU1OKRmnMevu?= =?iso-8859-1?q?oTEGR/R1pJl9wRtPq9+45w0FUh0yH0sFU/6di2GrogqkIwuqzHa?= =?iso-8859-1?q?mSxhTQKD9BEe70p5gvjxAU9idKRjG3KbRyL9HsLtqu06+WpJdke?= =?iso-8859-1?q?4ugcJDs4eOC2Ib5ltUnz69VCuxiwZoik/w1g2HknfHNOT6y3W9r?= =?iso-8859-1?q?7DTwiGssATcmX5os1z64UN/bwJ3/a1F3cl6D6LBXt0yH7fb9Lj+?= =?iso-8859-1?q?Ydtl3dONnafmSAktBQ+xNlyz0PwQ2JZIcDB+GKXIAPcHEVgDhp+?= =?iso-8859-1?q?dGKv3FdpQeBdQH3bMuBmlUd2BXu9cFvtNVfYIEy8kineJ3YaZU0?= =?iso-8859-1?q?cHqeru+KTWpL6kLeLiYsk?= x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ChFEKlijmToOAlVn5rSC5lQ23vfeWR5nyPDWa3As4cT66vcRI/27JNVs/lSD1vDwvwg998lHULJ3uMECTirBEVWdYsb2oLmxs1wlSF/gbxHdXS3O3QrZG7bqEQSLlwZMpaoq5QKU53KnXACchbz31J+d+zVZZbfuI2FcWKMjpV1KoW5vc+ygaNi91yj4IXdA/ZwUkVlqBC5slp8XpFXH9V8fqaWsQMw0lYpH0qhQz2dBOh24Ef9hlj8DVVdf/iom8LdG1laNXUwW8YLrMYtnsci82SvEF0BS3Cj7v/FGD6JdqOSN51SuEhnBvOBCeKwA5WFrouQDNUzLNIohOioOlQ2kpB8MzCnOwsFucxCFLbMH5B6TM07/Ob+PcmzRqFkpUNxXbBxA/hnpujRJ4rQ3m3U/BGkFvA4E3SW/PMRImbk= MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 56759a6e-cab9-4598-af7b-08d6a289af8c X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Mar 2019 23:15:56.1387 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB4592 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Heavily based on code from Ken Chen . Signed-off-by: Peter Rosin --- drivers/i2c/muxes/Kconfig | 6 +- drivers/i2c/muxes/i2c-mux-pca9541.c | 137 ++++++++++++++++++++++++++++++++++-- 2 files changed, 136 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index 52a4a922e7e6..8532841de5db 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig @@ -55,10 +55,10 @@ config I2C_MUX_LTC4306 will be called i2c-mux-ltc4306. config I2C_MUX_PCA9541 - tristate "NXP PCA9541 I2C Master Selector" + tristate "NXP PCA9541/PCA9641 I2C Master Selectors" help - If you say yes here you get support for the NXP PCA9541 - I2C Master Selector. + If you say yes here you get support for the NXP PCA9541/PCA9641 + I2C Master Selectors. This driver can also be built as a module. If so, the module will be called i2c-mux-pca9541. diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index 5eb36e3223d5..5d4e0c92e978 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c @@ -1,5 +1,5 @@ /* - * I2C multiplexer driver for PCA9541 bus master selector + * I2C multiplexer driver for PCA9541/PCA9641 bus master selectors * * Copyright (c) 2010 Ericsson AB. * @@ -28,8 +28,8 @@ #include /* - * The PCA9541 is a bus master selector. It supports two I2C masters connected - * to a single slave bus. + * The PCA9541 and PCA9641 are bus master selector. They support two I2C masters + * connected to a single slave bus. * * Before each bus transaction, a master has to acquire bus ownership. After the * transaction is complete, bus ownership has to be released. This fits well @@ -63,6 +63,33 @@ #define PCA9541_BUSON (PCA9541_CTL_BUSON | PCA9541_CTL_NBUSON) #define PCA9541_MYBUS (PCA9541_CTL_MYBUS | PCA9541_CTL_NMYBUS) +#define PCA9641_ID 0x00 +#define PCA9641_ID_MAGIC 0x38 + +#define PCA9641_CONTROL 0x01 +#define PCA9641_STATUS 0x02 +#define PCA9641_TIME 0x03 + +#define PCA9641_CTL_LOCK_REQ BIT(0) +#define PCA9641_CTL_LOCK_GRANT BIT(1) +#define PCA9641_CTL_BUS_CONNECT BIT(2) +#define PCA9641_CTL_BUS_INIT BIT(3) +#define PCA9641_CTL_SMBUS_SWRST BIT(4) +#define PCA9641_CTL_IDLE_TIMER_DIS BIT(5) +#define PCA9641_CTL_SMBUS_DIS BIT(6) +#define PCA9641_CTL_PRIORITY BIT(7) + +#define PCA9641_STS_OTHER_LOCK BIT(0) +#define PCA9641_STS_BUS_INIT_FAIL BIT(1) +#define PCA9641_STS_BUS_HUNG BIT(2) +#define PCA9641_STS_MBOX_EMPTY BIT(3) +#define PCA9641_STS_MBOX_FULL BIT(4) +#define PCA9641_STS_TEST_INT BIT(5) +#define PCA9641_STS_SCL_IO BIT(6) +#define PCA9641_STS_SDA_IO BIT(7) + +#define PCA9641_RES_TIME 0x03 + /* arbitration timeouts, in jiffies */ #define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ #define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */ @@ -73,6 +100,7 @@ enum chip_name { pca9541, + pca9641, }; struct chip_desc { @@ -102,6 +130,21 @@ static bool pca9541_busoff(int ctl) return (ctl & PCA9541_BUSON) == PCA9541_BUSON; } +static bool pca9641_lock_grant(int ctl) +{ + return !!(ctl & PCA9641_CTL_LOCK_GRANT); +} + +static bool pca9641_other_lock(int sts) +{ + return !!(sts & PCA9641_STS_OTHER_LOCK); +} + +static bool pca9641_busoff(int ctl, int sts) +{ + return !pca9641_lock_grant(ctl) && !pca9641_other_lock(sts); +} + /* * Write to chip register. Don't use i2c_transfer()/i2c_smbus_xfer() * as they will try to lock the adapter a second time. @@ -256,6 +299,86 @@ static int pca9541_arbitrate(struct i2c_client *client) return 0; } +/* Release bus. */ +static void pca9641_release_bus(struct i2c_client *client) +{ + pca9541_reg_write(client, PCA9641_CONTROL, 0); +} + +/* + * Channel arbitration + * + * Return values: + * <0: error + * 0 : bus not acquired + * 1 : bus acquired + */ +static int pca9641_arbitrate(struct i2c_client *client) +{ + struct i2c_mux_core *muxc = i2c_get_clientdata(client); + struct pca9541 *data = i2c_mux_priv(muxc); + int reg_ctl, reg_sts; + + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + if (reg_ctl < 0) + return reg_ctl; + reg_sts = pca9541_reg_read(client, PCA9641_STATUS); + + if (pca9641_busoff(reg_ctl, reg_sts)) { + /* + * Bus is off. Request ownership or turn it on unless + * other master requested ownership. + */ + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + reg_ctl = pca9541_reg_read(client, PCA9641_CONTROL); + + if (pca9641_lock_grant(reg_ctl)) { + /* + * Other master did not request ownership, + * or arbitration timeout expired. Take the bus. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT | + PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + data->select_timeout = SELECT_DELAY_SHORT; + + return 1; + } + + /* + * Other master requested ownership. + * Set extra long timeout to give it time to acquire it. + */ + data->select_timeout = SELECT_DELAY_LONG * 2; + + return 0; + } + + if (pca9641_lock_grant(reg_ctl)) { + /* + * Bus is on, and we own it. We are done with acquisition. + */ + reg_ctl |= PCA9641_CTL_BUS_CONNECT | PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + + return 1; + } + + if (pca9641_other_lock(reg_sts)) { + /* + * Other master owns the bus. + * If arbitration timeout has expired, force ownership. + * Otherwise request it. + */ + data->select_timeout = SELECT_DELAY_LONG; + reg_ctl |= PCA9641_CTL_LOCK_REQ; + pca9541_reg_write(client, PCA9641_CONTROL, reg_ctl); + } + + return 0; +} + static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan) { struct pca9541 *data = i2c_mux_priv(muxc); @@ -295,10 +418,15 @@ static const struct chip_desc chips[] = { .arbitrate = pca9541_arbitrate, .release_bus = pca9541_release_bus, }, + [pca9641] = { + .arbitrate = pca9641_arbitrate, + .release_bus = pca9641_release_bus, + }, }; static const struct i2c_device_id pca9541_id[] = { { "pca9541", pca9541 }, + { "pca9641", pca9641 }, {} }; @@ -307,6 +435,7 @@ MODULE_DEVICE_TABLE(i2c, pca9541_id); #ifdef CONFIG_OF static const struct of_device_id pca9541_of_match[] = { { .compatible = "nxp,pca9541", .data = &chips[pca9541] }, + { .compatible = "nxp,pca9641", .data = &chips[pca9641] }, {} }; MODULE_DEVICE_TABLE(of, pca9541_of_match); @@ -392,5 +521,5 @@ static struct i2c_driver pca9541_driver = { module_i2c_driver(pca9541_driver); MODULE_AUTHOR("Guenter Roeck "); -MODULE_DESCRIPTION("PCA9541 I2C master selector driver"); +MODULE_DESCRIPTION("PCA9541/PCA9641 I2C master selector driver"); MODULE_LICENSE("GPL v2");