Received: by 10.223.164.202 with SMTP id h10csp1054715wrb; Sun, 26 Nov 2017 18:59:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMZcjYF0yzqiAev5b0FJHXp3RSe4TqYHcfSIpRiNNg0b1hRst0oZlOQuuWTpHARLGb5DupRx X-Received: by 10.84.213.144 with SMTP id g16mr36841142pli.339.1511751554173; Sun, 26 Nov 2017 18:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511751554; cv=none; d=google.com; s=arc-20160816; b=g19Ff1kkpEvvpwEUNLJU9+ZLzY0EAxwF6g6cOUYccJUd4Jf1dgJuSC2G3XJ0/iwdmO CzdMA6/bOJ9TKKYZVlqHoDP82SoKz2jVbo6/vOEQ2XD/nR8zWx+8zHMkR41wMnuwJJpX WmW0sZnMPCIMDK6r9/lyPWB3d+vXknYqsCk5zMpBtxXiWFYHjjNgFISnPik2EK6wYeB6 X7MfgoW5Vnw6i0NrggVYDevtvOe5XogxsjRTn0p0sjTiqs2kdFznLEPfx0/HWbNvBOmA ZeM1SFno7dODD3s7rLKr8cNLth/jVLIbaXKcQOmkcMeTeKNdh5uxR0IL8sgMtK/6o95e bikw== 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:arc-authentication-results; bh=bMi8kyFreAf1U0AGjlYgzgAVF+N1s/WcsaihwIOxC2I=; b=OnSR0CGZvUa+dHyD/g9t4wG5nC/2Ms/+ofarAmbV/4NKT1orp7x6N/gdrUdKHH3vCt DW6hqKKcP5ioXy9a2MZhQnykFPPvJmkJGrEoP1Fm9Z42/fnh261vtYZN2/9FSs+BUjwX Pew4xXpsHc2DXz4NAiPZJ3PMnB1ouChU7bEtxgGJH/r3RtLWdm+ohXY2qEhKQGnZAObT 0plfWvIp5eQDmaxsnvYE7tPvMHPtdLuN1hpwaVzuzKp+hMWLDuuILN3yNvzUTjXGEdY/ rIqYLhN7EjM99cJvRGXfviRUXJTb1Pq6zgmA6wxQDVG6qJykLEIhrwWuNMR5+embgUVA jtvw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si21670681pgs.358.2017.11.26.18.58.55; Sun, 26 Nov 2017 18:59:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751138AbdK0Czw (ORCPT + 77 others); Sun, 26 Nov 2017 21:55:52 -0500 Received: from anchovy2.45ru.net.au ([203.30.46.146]:43188 "EHLO anchovy.45ru.net.au" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750844AbdK0Czu (ORCPT ); Sun, 26 Nov 2017 21:55:50 -0500 Received: (qmail 13929 invoked by uid 5089); 27 Nov 2017 02:55:46 -0000 Received: by simscan 1.2.0 ppid: 13745, pid: 13746, t: 0.0934s scanners: regex: 1.2.0 attach: 1.2.0 clamav: 0.88.3/m:40/d:1950 Received: from unknown (HELO ?192.168.0.122?) (preid@electromag.com.au@203.59.230.133) by anchovy3.45ru.net.au with ESMTPA; 27 Nov 2017 02:55:46 -0000 Subject: Re: [PATCH v4] iio : Add cm3218 smbus ara and acpi support To: Jonathan Cameron Cc: Mika Westerberg , Wolfram Sang , Jonathan Cameron , Marc CAPDEVILLE , Kevin Tsai , Peter Meerwald-Stadler , Hartmut Knaack , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Pandruvada , Benjamin Tissoires , Jarkko Nikula References: <20171027161426.m27e52jvnpgembsu@azrael> <20171102143550.00005a66@huawei.com> <20171102150407.bparxxskfo5pzvvs@ninjato> <20171119163551.5d52dec5@archlinux> <20171120105756.GC22431@lahna.fi.intel.com> <20171125135711.174d2683@archlinux> From: Phil Reid Message-ID: <577fbb51-2dcf-fe0f-f4c8-08e29699896d@electromag.com.au> Date: Mon, 27 Nov 2017 10:55:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171125135711.174d2683@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/11/2017 21:57, Jonathan Cameron wrote: > On Tue, 21 Nov 2017 09:22:16 +0800 > Phil Reid wrote: > >> On 20/11/2017 18:57, Mika Westerberg wrote: >>> +Jarkko >>> >>> On Sun, Nov 19, 2017 at 04:35:51PM +0000, Jonathan Cameron wrote: >>>> On Thu, 2 Nov 2017 16:04:07 +0100 >>>> Wolfram Sang wrote: >>>> >>>>> On Thu, Nov 02, 2017 at 02:35:50PM +0000, Jonathan Cameron wrote: >>>>>> On Fri, 27 Oct 2017 18:27:02 +0200 >>>>>> Marc CAPDEVILLE wrote: >>>>>> >>>>>>> On asus T100, Capella cm3218 chip is implemented as ambiant light >>>>>>> sensor. This chip expose an smbus ARA protocol device on standard >>>>>>> address 0x0c. The chip is not functional before all alerts are >>>>>>> acknowledged. >>>>>>> On asus T100, this device is enumerated on ACPI bus and the >>>>>>> description give tow I2C connection. The first is the connection to >>>>>>> the ARA device and the second gives the real address of the device. >>>>>>> >>>>>>> So, on device probe,If the i2c address is the ARA address and the >>>>>>> device is enumerated via acpi, we lookup for the real address in >>>>>>> the ACPI resource list and change it in the client structure. >>>>>>> if an interrupt resource is given, and only for cm3218 chip, >>>>>>> we declare an smbus_alert device. >>>>>>> >>>>>>> Signed-off-by: Marc CAPDEVILLE >>>>>> >>>>>> Wolfram - this needs input from you on how to neatly handle >>>>>> an ACPI registered ARA. >>>>> >>>>> ACPI is really not my field. Try asking the I2C ACPI maintainers or >>>>> Benjamin Tissoires who did work on SMBus >>>>> interrupts recently. >>>>> >>>> Hi Mika, Benjamin, >>>> >>>> So we've lost most of the context in this thread, but the basic question >>>> is how to handle smbus ARA support with ACPI. >>>> >>>> https://patchwork.kernel.org/patch/10030309/ >>>> >>>> Has the proposal made in this driver which is really not terribly nice >>>> (as it registers the ARA device by messing with the address and registering >>>> a second device). >>>> >>>> As I understood it the ARA device registration should be handled by the >>>> i2c master, but there are very few examples. >>>> >>>> Phil pointed out that equivalent OF support recently got taken from him.. >>>> https://www.spinics.net/lists/devicetree/msg191947.html >>>> https://www.spinics.net/lists/linux-i2c/msg31173.html >>>> >>>> Any thoughts on the right way to do this? >>> >>> There does not seem to be any way in ACPI to tell which "connection" is >>> used to describe ARA so that part currently is something each driver >>> needs to handle as they know the device the best. I don't think we have >>> any means to handle it in generic way in I2C core except to provide some >>> helpers that work on top of i2c_setup_smbus_alert() but understand ACPI >>> resources. Say provide function like this: >>> >>> int acpi_i2c_setup_smbus_alert(struct i2c_adapter *adapter, int index); >>> >>> Which then extracts automatically I2cSerialBus connection from "index" >>> and calls i2c_setup_smbus_alert() accordingly. >>> >>> In the long run we could introduce _DSD property that can be used to >>> name the connection in the same way DT does; >>> >>> Name (_CRS, ResourceTemplate () { >>> I2cSerialBus () { ... } // ARA >>> I2cSerialBus () { ... } // normal device address >>> }) >>> >>> Name (_DSD, Package () { >>> ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), >>> Package () { >>> Package () {"smbus_alert", 0} // Where 0 means the first I2cSerialBus >>> ... >>> } >>> }) >>> >> >> I wonder if it's worth involving the smbus_alert driver in this case. >> The cm3218 driver doesn't appear to be using the alert callback in strcut i2c_driver. > > True - though it really should be.. > >> So the smbus_alert driver is not going to notifiy the cm3218 driver. >> Are there more than one alert/ara capable devices on the bus? > > I'm not keen on taking a work around for one board on the basis that > it only has this one device on the bus - we will probably get a different > one down the line where this isn't true - then we end up ripping up what > has been done so far and starting again. > > I don't mind having some ACPI matching code in the driver but it needs > to use the ARA infrastructure to actually handle things... I'd agree, I only suggested the approach as the driver didn't seem to be using the alert callback. Without using that callback there seems little point using it IMO. As you say the better approach is to have some generic ACPI code for the alert. > > If we then get nice generic ACPI code via some other means in the future > we can move the driver over to that. > > Sometimes I wonder if some people just write ACPI tables with no though > to generalization at all, or that the code running might be shared across > different machines. (sometimes that assumption is valid, but not that > often... oh well - usual case of if we all work together everyone wins > but not worth one company trying to do things right...) > >> Perhaps a workaround in this case is if that acpi entry is defined the cm3218 driver >> handles that ara request directly to clear the interrupt. >> > > Jonathan > > -- Regards Phil Reid From 1585046868445754041@xxx Sat Nov 25 14:01:28 +0000 2017 X-GM-THRID: 1582417070883902009 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread