Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758046AbbEWRFX (ORCPT ); Sat, 23 May 2015 13:05:23 -0400 Received: from mail-bn1bbn0105.outbound.protection.outlook.com ([157.56.111.105]:29301 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757961AbbEWRFU (ORCPT ); Sat, 23 May 2015 13:05:20 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yorksun@freescale.com; Message-ID: <5560AFDB.30307@freescale.com> Date: Sat, 23 May 2015 09:50:35 -0700 From: York Sun User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Guenter Roeck CC: Lee Jones , , Subject: Re: I2C class bitmask References: <555E4913.9070805@freescale.com> <20150523162737.GA4981@roeck-us.net> In-Reply-To: <20150523162737.GA4981@roeck-us.net> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.88.168.50] X-ClientProxiedBy: SN1PR0701CA0025.namprd07.prod.outlook.com (25.162.96.35) To BY2PR03MB159.namprd03.prod.outlook.com (10.242.36.18) X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB159;2:FVOV01pjkm7V0AdQJLMQQM0NmyZAc2Ch0WA32LhxmNLuF6z7Zv2tWjNXfZ9bYQLd;2:xOcToaiaBE5K0c864BUg4Oc/K2lrJDkDdtwOlbrGLdpneoUODcssFmAf3OBowsuLn3qhLEVGHglLNM+vrGtpUDTEcl+m1cOrjp9ft9gvfQ5R+AldtbIEJRX/vnaiILCdpqbc4M57zIYkTw9hnOeBKg==;6:1tvMRiCjS0yd78/PdRoqKnwIuXJszPc/LXdtefFeXOzOy4XJO9Yy3EtWeU8fwWQ17zRFG15H8y2uMi2VuCxuswrA8DolLb3WYmwZSHUH6upM4cYFG1WrqZSbmtIPLhfqKqsVs4e/bx/3V2xG7xBUDGyVcMwFTGe2O1vm2Vm6nVF+9S/wnvT9pAyCJDyYj8BEuBy4C1pCG4y14oC328ceKaV8701PhfOYywtNceiwUCCFdWh03B0FYxONW02tZ7XPvS+RJe9oEqpCMGjKR4NvPPvk/zTYVdN9iOS+ePIa++XJJTi9HwXX55sxYqajmKir0ACv0NzjxEXEfgKPjS7AzlA96GopS3sXA6xKqN/mlWYz9lFAQSXD+dKZn5IecprjQrEVk8HTDbb/zVAj+n6JgsD+IcRHgbJJ4BKR+i8xA/nSQzF602xRT4TVwA1orxEWhYMvpwMboVemZJHOPYpLT58nM0zgOrRAAbcC/A5iYzq8k+cY0zkD9CZsZfzWW6U8epDjFferEqLWoMYnaG0aR+hseJBXyi/HaggQI6uineofrGB5TEFx7PYpka7zkT5IX2KfyaH1EkF6LPbMVt0lgcVDxdBtOB5yH0HWZ8wsA4M= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB159; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520002)(3002001);SRVR:BY2PR03MB159;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB159; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB159;3:P+Nd9MtDUK2pZLCymGqR+u2cwLWV9qZ/DFGkErH6E0O2EcDw25WB/RDwGEgEPqlLOxLeKsXDyALOJhVLN3IFtz9/u8CqvfDbEkgaplHV2FBtINKmscyzZ2ibWVtC93aK1i0/bU2jc1OAN+5NB8+gsfQr8zHhfs6lHTbmb2Pc0EweNunItr1nG0gIqsMeL7KWGMA2EkVbqSOk6IecLC3UtMPS6tE4quxFB0iLpMRuV3zGqk31hFbJu7CUXOEF2qHeHkp81Br74zhhEoIEOBlqmrx5kQiYq3CZEzSIy4AbjNew4Ely409BKaRQi3gob2Z6 X-Forefront-PRVS: 0585417D7B X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(6049001)(479174004)(52604005)(51704005)(24454002)(189002)(377454003)(43784003)(199003)(122386002)(23746002)(64706001)(105586002)(50466002)(36756003)(86362001)(77156002)(101416001)(54356999)(42186005)(68736005)(40100003)(81156007)(77096005)(66066001)(110136002)(50986999)(2950100001)(65806001)(97736004)(65956001)(33656002)(4001350100001)(4001540100001)(62966003)(46102003)(83506001)(92566002)(189998001)(106356001)(5001830100001)(5001960100002)(76176999)(47776003)(5001860100001)(64126003)(87976001)(65816999)(21314002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB159;H:[10.214.80.161];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BY2PR03MB159;9:9GtBk2U3Q7UDMPOzHatEE2oTROWcbhXDO+KIwBg?= =?Windows-1252?Q?Zb+5JQ5IE+d3Uhw6qVO5OXJihcdNvVbXjlKOsYePSmYXbBFaOvxpakDJ?= =?Windows-1252?Q?uNsFQZhUvBKBY7sVXqF3RlVd2r/WDuK/NqTdcC3bS0HXGCd/1YRjDnN0?= =?Windows-1252?Q?wmk67RGbTFmiSrofHsejp2dQI/tWlP3Q7qadiD5P7gqdgZRyEzSjANLq?= =?Windows-1252?Q?cxn0RmFXu7eiLWuMM3wKSVhnkrxc9yRog54T9zT6n80bUGz302cc47vL?= =?Windows-1252?Q?kBTpHW6tG+7Wis6OQtHt1b3RxE5v9miYIyR+eCchY00OpjXl3GuDWqnv?= =?Windows-1252?Q?S8K6XhkhZSTWnikbTxf8sn4qRA+IDBo8oBMMDnViVRLfkHKzc8We/LMJ?= =?Windows-1252?Q?vhasXBy95fMDYb4ORfCg4h6zDIqKsL+GFK/fMtnhrKChksmsGDNzsGVo?= =?Windows-1252?Q?LjRL0ohs2mST7ZGCjfiPV6WN+HHVzWqCmBNttXGVDrRIoUZSaEezd2qp?= =?Windows-1252?Q?2effcBYCRQppoEr6e+XxAMPZsmu0P+c2KI21PBeh7GK8cvGvF8//6yJW?= =?Windows-1252?Q?vTOx4WaQxSped+YzslrTZOZFwdf2vOdhoPTrPdref8pd9yphhCYbDNJh?= =?Windows-1252?Q?xYUjhF0T78tNwVjMQ30g4V5zi3vBXP/1upV1p66PZ+p4fvxRbzkLn9E2?= =?Windows-1252?Q?ynP7lHbbu3Wstc8zq+WsZVArG+wEexxY/De9gQ9cEfq8mFDvZu3R3b0k?= =?Windows-1252?Q?25YzO6DLFkpfjfzkOJP/xd/signRMEKhH0cOxZpEQCYkAUqY7db+AfVw?= =?Windows-1252?Q?eHZD/JRzi6KtzWwWdxp9uVgBUdcQBjqpT30y03dpNcdXRlT4XPI4ozHp?= =?Windows-1252?Q?7FDmlGiGRQlSFqsb8F7qJ96dMJwI1rNf7spju+PRmZ+Dfhc0MHQuA5XF?= =?Windows-1252?Q?dKUusKtnGNtSCvPv4oK0jV5UH0HucQeHa5PxzkVsWJJgxLz2wKAo8KMy?= =?Windows-1252?Q?rCx96w9aH87u+02ym//yEBJDuU7zd4YdZZDus9RYV3VQA06hInH4eid8?= =?Windows-1252?Q?QPUck+1T+iRs4quOulC5CD+5RShK/b2VY9y1ZmK0OQMAW0GABTEta0P/?= =?Windows-1252?Q?7PrnIKcP0jSkPxyDvtL1tzUQSIYdUmDjbVGTTeFWC71t+UpRcxPSkSId?= =?Windows-1252?Q?lntoOIzykubLwQS4FXmbieVnZ8Dok/oIu0vR386rj2pefRYDNiBEEUz7?= =?Windows-1252?Q?lQZCeQZHpbz+XRHz1LFnK6f+PAf9XT1+3IMNfCwv1eI0U9GBmyiksnEh?= =?Windows-1252?Q?U1l3TQuWUrCaunkQfEo5tAKihHHhurGg9m31kBurZXVqKgzoOxYJPIeq?= =?Windows-1252?Q?86p08OLi/?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB159;3:6Q2CLVrtTh4Qh6LjhFoQL6k2PULxA3+RSqrWBAYLzwmbb596sf8jVZs4mnEka8TWiW8mvvQ8hsXkwvNj9ZecjOSoW+ZXKULYov8U1h4NLXCVIwwhHO7fGkcGlvFu2AAQaRVWZ6gUJc2TD5kA9laGdg==;10:5Tt5HctCqRBn0jNJeE1x/ktP+GaSHBnSOTFwewQmB1E+yJ7/DfXlzCuv/7m/en9PfBC3EXF7cuSna2Y1uIt2PTgnD3Ymhy6f19ltqQ4JLBM=;6:T/RwMxGFTmMqBJGtAWVObunRFYv2eLZsv74x4Ync79wgUByu1X7LXAEArqEOrbm8 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2015 16:50:45.1402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB159 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2984 Lines: 66 On 05/23/2015 09:27 AM, Guenter Roeck wrote: > On Thu, May 21, 2015 at 02:07:31PM -0700, York Sun wrote: >> Lee, >> >> Is there any convention regarding I2C class bitmask? I see only three are >> defined for 3.12.19 and four for 4.0 >> >> I2C_CLASS_HWMON, I2C_CLASS_DDC, I2C_CLASS_SPD, I2C_CLASS_DEPRECATED >> >> I am working on a clock chip driver (SI5338) and trying to detect them (multiple >> chips in i2c mux). It would be a lot easier to have its own class, like >> I2C_CLASS_CLOCK. It is trivial to add a line to i2c.h file. Just checking if >> this is a bad idea. >> > > A class is supposed to indicate if a specific chip class is likely to be seen > on an i2c adapter, and that it may be necessary to auto-detect it (an example > are I2C_CLASS_HWMON type devices on PCs). The tendency, though, is to drop > existing markers for I2C_CLASS_xxx from adapter drivers as much as possible > because it slows down the boot process (see upstream commit 0c176170089c3). > > Auto-detection (with the _detect function) is not a preferred means to > instantiate a device. It takes time, and it is more or less unreliable. > For some chips, a read on its i2c register space can result in a chip reset, > or it can cause it to lose its programming. Worst case it can turn a system > into a brick. > > Preferred instantiations are listed in Documentation/i2c/instantiating-devices. > Instantiation with devicetree, ACPI, or through i2c_register_board_info() > would probably be the best available methods to instantiate a clock chip. > > Given that, first question is why you would want to have the chip auto-detected > in the first place. Is there any reason to believe that explicit instantiation > would not work in your system ? What are those reasons ? > > On top of that, the SI5338 does not have a clean way to detect the chip. > It does not have a chip ID register, and it is multi-banked. Given the > similarities of the various Silicon Labs clock chips, it may not even be > possible to reliably distinguish it from other SI chips. So even if you > had a good reason to auto-detect the chip, it would be _very_ unreliable. > This seems to be quite undesirable and risky for a clock chip. > Are you really sure that you want and need that ? > Guenter, Thanks for replying. No, I don't have to use autodetect. I was curious why there weren't more classes. I failed to notice which method is preferred in the mentioned document. I used to declare the devices by the bus number but met some issue when they are behind a mux. I temporarily used auto detect before I figure out how to describe the mux with i2c_board_info. Knowing auto-detection is not preferred, I will remove it from the proposed driver. Thanks again. York -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/