Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp946109ybc; Tue, 12 Nov 2019 11:39:53 -0800 (PST) X-Google-Smtp-Source: APXvYqziPr6GyZFYCa5IcDXRNY3ZohP839goCaJgFTSfH0i/aVQceKRdyy0cOjo/sNJaI7VprIUk X-Received: by 2002:a17:906:25cb:: with SMTP id n11mr28200592ejb.239.1573587593603; Tue, 12 Nov 2019 11:39:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573587593; cv=none; d=google.com; s=arc-20160816; b=vLpPzpb59fNxbLnHqUSrKa61AACnv0tSrmOWseCO7UMIl2Ux22iqxUuUi9lV6Qv1xK 62YdFtnTEpX/9XyPEXYgJtvvqBVOVuS1LAVT2c/Ck4rhLJtrWt1SES4aOAyt699EQ/Vi iUBTu8uPgtOVLNMf38ekhvtb/oOp1L7NMIfdgaTbQz5APYy09tK4IpgXJjkL8RKYWQBw YkFCp6YzEWtIbRTEzgYAjeVrTEJbZ8VaXo+mfTtl+abJ5iPstVGeJp2i98IGoH0r5W37 y+rX+zq62ztZKWMs/atbsWkQVMZOPUTN/RAc8Ync5Iq5oZ0PRPRh5AjdiOUml/mo67j0 qOpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0La2CwEbsU0iGpHRN+E6CgdPEQt/LTHDnbCunj4lTb8=; b=tUtCSyYDyXmIzuh2gnXh2K/EqJ5ZlZfmtjY5FewGb9gY0ZdyrnolCZ5cFcAijxfx6j VXF5cGYnXZvRNWWgORBPM3glbsU4gW/mlAq0sjL7YaXwhsVaMfvrbbql+4T6/+ex0X6l HGKUHZHD9KvH0Fa8luw9p+2WlIqJMShTj/yZmRyqiqyI4D9AlqKHV+WyBspVlR15zsua Glz1nJ0p0/Dbcv+tsiHe9/MjQkqKm8JuN1YDk8SsDQA4Kh8bG1tREyVM77MvVm+61zbh kyj0mK23xUZpbPhBDOzOkZfZThMmpskBEAREniBwh8ag7liotc4ky1vSFKN9Jh7fglZG uQRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VL+s3q4J; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qn27si610289ejb.426.2019.11.12.11.39.29; Tue, 12 Nov 2019 11:39:53 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VL+s3q4J; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727148AbfKLTiP (ORCPT + 99 others); Tue, 12 Nov 2019 14:38:15 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45501 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbfKLTiP (ORCPT ); Tue, 12 Nov 2019 14:38:15 -0500 Received: by mail-pg1-f193.google.com with SMTP id w11so12488068pga.12; Tue, 12 Nov 2019 11:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0La2CwEbsU0iGpHRN+E6CgdPEQt/LTHDnbCunj4lTb8=; b=VL+s3q4JE6h3dgJv7/N9uNIKe2mR2SJGxXYbo+a1AB3kkBkuDmf9fbBhr3tDyAVwnT OYORuGVOakJjTDiwQxel/n3/wsKYXljpRVC+j3B12ryXEwiu5/JrFQ+jqcxiVEo0olBG MI25O+WLxcwdoLjicMSqAFH4wtKmDsxUiU+hD7lSOLcb7IZzbryzbaMOyRm5hP8lk1gd zyk+zQNSHx/J4GOZZ5ZGeiYsX4WpFxg+Cc50JZu/LUT8sbXnwX72++euhDkVcTc8+hKK AiW2Lv0hXclDEtlSUVI9NW8d8svDe2rAvVkYCWtTGKhR3Kr6zL2PdqTR8pNeya4T2ITg zP3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0La2CwEbsU0iGpHRN+E6CgdPEQt/LTHDnbCunj4lTb8=; b=np0P+iVsivdgJc5gtgMtsb9lyI6YkJxtztz/rakdRl8MeKa+p6RxZFTvQheoUWh7Mu WZ8lQFtK1/jwxlNO/A6HMuFUCRlmkVGEWWt5TslbPYht8YkrWqckCCfLthUoWUwE7jTt vyX4TOzEJIc0iTI9vCaRClTaHfdLUdTuL6j+rI4Daa3IeLXszSJHn0x+5ds5Ec8pY0Ek NTj9CHNPXjvl61ntz8qxj+MaryFteOdhQ1krHaw2u87lYqdN9uPlJeOgVU0T9OJX1MG8 CBOpaE2bODOvvgaloIlzSjPt4FiHQNy8m9R3r6sYKxQhmFpw/DCVfU7QTgZgZXRZviP8 AQDA== X-Gm-Message-State: APjAAAV2mJZWfeqnaghrRT9nWcra2W8tPyEm1XmRaE0S8XTdcRrsiLvK Ww8UvUkdayN1LGgojcX6RE8= X-Received: by 2002:a17:90a:280e:: with SMTP id e14mr8720772pjd.135.1573587494177; Tue, 12 Nov 2019 11:38:14 -0800 (PST) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id 81sm23692014pfx.142.2019.11.12.11.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 11:38:13 -0800 (PST) Date: Tue, 12 Nov 2019 11:38:11 -0800 From: Dmitry Torokhov To: Sven Van Asbroeck Cc: Marek Vasut , Adam Ford , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Subject: Re: [PATCH v1 3/3] Input: ili210x - optionally hide calibrate sysfs attribute Message-ID: <20191112193811.GC13374@dtor-ws> References: <20191112164429.11225-1-TheSven73@gmail.com> <20191112164429.11225-3-TheSven73@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191112164429.11225-3-TheSven73@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 12, 2019 at 11:44:29AM -0500, Sven Van Asbroeck wrote: > Only show the 'calibrate' sysfs attribute on chip flavours > which support calibration by writing to a calibration register. > > Do this by adding a flag to the chip operations structure. > > Link: https://lore.kernel.org/lkml/20191111181657.GA57214@dtor-ws/ > Cc: Marek Vasut > Cc: Adam Ford > Cc: > Cc: linux-input@vger.kernel.org > Tree: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git/log/?h=next > Signed-off-by: Sven Van Asbroeck > --- > drivers/input/touchscreen/ili210x.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c > index 4321f0d676cc..810770ad02e2 100644 > --- a/drivers/input/touchscreen/ili210x.c > +++ b/drivers/input/touchscreen/ili210x.c > @@ -32,6 +32,7 @@ struct ili2xxx_chip { > bool (*continue_polling)(const u8 *data, bool touch); > unsigned int max_touches; > unsigned int resolution; > + bool no_calibrate_reg; Please use positive logic and have chips opt-in into the calibration. > }; > > struct ili210x { > @@ -162,6 +163,7 @@ static const struct ili2xxx_chip ili211x_chip = { > .continue_polling = ili211x_decline_polling, > .max_touches = 10, > .resolution = 2048, > + .no_calibrate_reg = true, > }; > > static int ili251x_read_reg(struct i2c_client *client, > @@ -310,8 +312,19 @@ static struct attribute *ili210x_attributes[] = { > NULL, > }; > > +static umode_t ili210x_calibrate_visible(struct kobject *kobj, > + struct attribute *attr, int index) > +{ > + struct device *dev = kobj_to_dev(kobj); > + struct i2c_client *client = to_i2c_client(dev); > + struct ili210x *priv = i2c_get_clientdata(client); > + > + return !priv->chip->no_calibrate_reg; > +} > + > static const struct attribute_group ili210x_attr_group = { > .attrs = ili210x_attributes, > + .is_visible = ili210x_calibrate_visible, > }; > > static void ili210x_power_down(void *data) > -- > 2.17.1 > -- Dmitry