Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp844999imj; Fri, 15 Feb 2019 07:45:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IbS8fq+BzyTIfc8nkSJA22hdCZImSl8CF5maoKKbtCigsjfII/Yj9kW6evBQZaIrI5/GF2k X-Received: by 2002:a17:902:2ac3:: with SMTP id j61mr10844445plb.185.1550245519783; Fri, 15 Feb 2019 07:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550245519; cv=none; d=google.com; s=arc-20160816; b=OMdrarm78vsO2wHmUyqKtNI80cJKgsFen6QRqCw5yfkWpmJCKbLEdg1MFMPog10Igk uxJFwetLrH4TuBddYTI76ZXr0wh/sFSV0Ot6tnG5jtZQoWeBAdOwpoWx7CRDacPzZhVN cFpcSWIlyHwcOOEbOgavd3UL5Ay9zDWA3Zz9tVLYdMYAmj/E4jddlBNMAwqAx5RAnUxf RfaGnLvfMtd8MXmrS5ewMSyxGuFk33nVdn1GrBYhsP5aoPPE28IAYUrFD7DOnci8+dhb ASqmu6pjV0Gjm+0hcfyDGtrfM83OYu0HlXQzmCDGGO8CpenXb96xI+sGAHp2usDiBvOw 81OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=qjDqxUzQ4iCx9u6GGJkH0PZ3NpZqIq6Io1QGiYt8yrM=; b=l9mixY5Rq+hvjNbZ1ad+B2/Zg5reF9oL23Ci4cxN0A2HSZXpt9aOAddx19scub34gs bd7RCoNK0D3JEhFRfvODz/hrWFJOQNvlXacz9Kq2kr62hhMO4rOmMbeN9uRWqbk+5903 1JyHndm2o2M7BInPYCd44SmXO0uXZOmkNYJV8Ga40A/LXGIt2UAFdc70eRXuu3NJuzHp fFPfWi7Wtad7HdjGbSRjqT7U26jvXxbYlhKadk1zbwNVtnXm1Jb7y1kY/wcTMkBuf23w gMeyzb90RgwLNZKcdRIa4Wuxpdz45w9rOJdOBWSjoyOLDgSMugwUOSspEqi2usqmzMJx P82w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si5537441pgh.392.2019.02.15.07.45.03; Fri, 15 Feb 2019 07:45:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403813AbfBOJ0f (ORCPT + 99 others); Fri, 15 Feb 2019 04:26:35 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:41728 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732306AbfBOJ0e (ORCPT ); Fri, 15 Feb 2019 04:26:34 -0500 Received: by mail-ed1-f68.google.com with SMTP id x7so7369591eds.8 for ; Fri, 15 Feb 2019 01:26:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qjDqxUzQ4iCx9u6GGJkH0PZ3NpZqIq6Io1QGiYt8yrM=; b=pI2O5Ht74PMUG83ndwqEbVvdxL9whnC70JxwHmrWWzd908YSaeMHxjIRTLbwwLkPir soIaDeljFrJHY9kx7mjX1XcC/BEtXVlfggyEAURmUfOetbKVmuzh0YrRqFmZeMNQ9BT1 e+bUxfKTv9TnDAsoQLogFkqlfkbV7IwKYoRmuPJHt7RUFs7omCOZMKav92Qr+wkqK95t DRy3bC6lyjkWEkS07goWaHv53fKsFfwQ8Fu6ZMjfR0diOGMDLqeP2aojKwQUZXRYVdus IUsrj9QM0GA4mgWC+pOpV1uWAbFw5iostnuIaiZkvd7QmzSDQ23dNtblhL9ha9u+Vegi d9OA== X-Gm-Message-State: AHQUAuabQj2HJvT9hMipaEsqzzUIeLFKMG88aaiUb2DP/9n6rEJnTh8g 9gV76fzCiHOrAmvZeRtcw7wURw== X-Received: by 2002:a17:906:33c1:: with SMTP id w1-v6mr5947979eja.49.1550222792276; Fri, 15 Feb 2019 01:26:32 -0800 (PST) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id s7sm850451edr.86.2019.02.15.01.26.31 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 15 Feb 2019 01:26:31 -0800 (PST) Subject: Re: [PATCH 0/2] extcon: Intel Cherry Trail Whiskey Cove PMIC and external charger tweaks To: Yauhen Kharuzhy Cc: Andy Shevchenko , linux-kernel@vger.kernel.org, MyungJoo Ham References: <20190210203649.21691-1-jekhor@gmail.com> <7d226dcc-9b9c-941c-7915-53ca123fa3a5@redhat.com> <20190214124744.GT9224@smile.fi.intel.com> <1026e999-ecda-7866-6607-3c947a4cb483@redhat.com> <20190215070103.GC30250@jeknote.loshitsa1.net> From: Hans de Goede Message-ID: <952f3152-bf02-beff-7841-a414566912e9@redhat.com> Date: Fri, 15 Feb 2019 10:26:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190215070103.GC30250@jeknote.loshitsa1.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 15-02-19 08:01, Yauhen Kharuzhy wrote: > On Thu, Feb 14, 2019 at 04:05:26PM +0100, Hans de Goede wrote: >> I would do something similar with the fuel-gauge in >> drivers/platform/x86/intel_cht_int33fe.c, one option would >> be to simply count the number of resources in the ACPI >> resource table for the INT33FE device, versions with >> the Type-C port have 7 resources, where as your INT33FE >> device has only 3. >> >> I'm even thinking that it might be best to rename >> intel_cht_int33fe.c to intel_cht_int33fe_typec.c and add >> a check for the resource table having 7 entries there, then >> you can make a intel_cht_int33fe_micro_usb.c copy and strip >> that mostly empty. Both would bind to the same "INT33FE" >> id and they would both silently bail with -ENODEV if the >> resource-count (or the PTYP value) don't match. >> >> The reason I'm thinking of having 2 drivers is because >> the current intel_cht_int33fe.c is quite special / ugly and >> already has enough ifs. >> >> If you do a stand-alone intel_cht_int33fe_micro_usb.c that can >> hopefully be much simpler. >> >> Andy what is your take on having separate intel_cht_int33fe_typec.c >> and intel_cht_int33fe_micro_usb.c drivers, both binding to >> the "INT33FE" ACPI-ID (with its totally !@#%$#-ed up "API") ? >> >> Having 2 drivers bind to the same id and exit silently with -ENODEV >> is somewhat normal for USB ids where we also sometimes have these >> kinda ID clashes with different devices hiding behind the same id. > > Hmm... And we need to handle case when all three INT33FE devices are > enabled in the DSDT... I would not worry about that, I've never seen that and even then counting the resources + the PTYP check should catch this. > Instead of separating of driver to two (and more when we will find new > CHT device...) I think about some kind of configuration variants table > with selection by PTYP/resource count/etc. But typeC devices will > require to define interconnections for example and we will get yet > another hardly readable code with quirks, autodetection magic and big > constant tables... Right, the issue is the code for the variant with the Type-C connector is just quite ugly, also with the cht_int33fe_check_for_max17047 firmware bug workaround, I would prefer to keep that isolated to a single file for just the devices which need all these kludges. The version for your device should be much cleaner and if we need another variant we can maybe make your version be a generic version for this with some config table, but adding more special casing to the current code is not a good idea IMHO. > OK, I plan to start to make some experiments with this at weekend. Sounds good. Regards, Hans