Message ID | 20221207190348.9347-1-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp357963wrr; Wed, 7 Dec 2022 11:06:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf4N/NwWWZxeRwyVqDdSRA0jfNwRtwl/diQRt6SNdLpGwp8pC9DNQNIqd0IUcspKni/mjRJh X-Received: by 2002:a63:5d58:0:b0:46f:f383:6faf with SMTP id o24-20020a635d58000000b0046ff3836fafmr82888375pgm.247.1670439967159; Wed, 07 Dec 2022 11:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670439967; cv=none; d=google.com; s=arc-20160816; b=o71Co0Rtx1Ye0+T39gL83JIk3k0TlNLjdNLAi7+sCfl/nm3M0TedlXd+vTwiH1pOv1 pntbf9RO7/HI+zTywjd3xwAjVkHf2/ukPDVNGH2qKEVrsY5OYBdZFgqKqZd4bOiBPY+b vnetwRsTYP/HyTgJOQ37UvWQOYvfJXkitD0kPNwVcMnEXpx/RpK3qHXwBecuCsuSnYtL w124rAmPqW+EfAllkqImk87nrz+Rreg0kCJMyHN1asB7HhKQjG/7xfy25mR6gm+2gceF 5hpvjK9DHdvQ6rWbZFwMZLdTBXFdiVdNPJFhwNh4GxDXC9JJU7KCwcFN5H2Xc54Fi7wP JmNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z3Pw9GaqKLFAchmSQAR4mzQwnDwaDPmp4KgNXjEuIxU=; b=dXfjulIH3TqDIchzEG4LKuMdRtbJEErruastQyuLlTMgQ4HEFfFvKQEns8BNhDPWcM 4UTt2w650rPOnuUiKcC8FvjjsW9Os5T6eMmpDHPAx8HAy+WcM2KRgo648Hc+tboDIU9Z wcuIhvft5E/BvxC6HEIRLpAVv8SbN2LW+I9f0VmRSrdRx+8K4WxqL2oAhYu7OkYJViyg jnF+qMsE4WnUdIm3G7vWlKjSLe2rSIfxcoPFgcYNpWXkUq+WkYN2Y/Iz6zk+b5WTLaYD YFfsNc5kCjwM0+BJkktU7PzhY6QkPdWYb4WU/abRLVQv8vQSf+weD2GGiJnnBRrIaIh8 M6XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h2L/fBbP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a63e014000000b0046fd05d55e0si20830912pgh.567.2022.12.07.11.05.31; Wed, 07 Dec 2022 11:06:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h2L/fBbP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229836AbiLGTEO (ORCPT <rfc822;foxyelen666@gmail.com> + 99 others); Wed, 7 Dec 2022 14:04:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbiLGTEE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Dec 2022 14:04:04 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB7476F0EC; Wed, 7 Dec 2022 11:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670439842; x=1701975842; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vKGtpM5JSZarHWj35MDsk6li/lREkuRPGsDfjh4bQXA=; b=h2L/fBbPH63mgaslX9b7ICO+UMgzfjc+tC9DQLecLiJYtAYbEnn+2k7n AId9nT2E9QAfKz3E8KJw+ot600kgi0kY55rjQXbXnhOqEV0eIdEI1pXnR 5/a5oVgBAWHeOn3EBjriE2OwIGcrHMuwYsPjioK8TJCXQg3TyQkobe3Mo N3H8uDuPf6FsTH12go4lIxxb+tazvMhSOx1FNfhT0PKEPzZeFwdDrwArl coFmLpH3fa/agjrf7ZUwFVYI9hDKuXuASkECfWOFj9Vm0AX9U50+JWPXt w6lqsI1mH6KLb50inOHOV150swFORtyXkCYsopWNBZzJqS/8r30Kce+Zw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10554"; a="315690223" X-IronPort-AV: E=Sophos;i="5.96,225,1665471600"; d="scan'208";a="315690223" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2022 11:03:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10554"; a="821060667" X-IronPort-AV: E=Sophos;i="5.96,225,1665471600"; d="scan'208";a="821060667" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga005.jf.intel.com with ESMTP; 07 Dec 2022 11:03:40 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D5B94F4; Wed, 7 Dec 2022 21:04:08 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Ferry Toth <ftoth@exalondelft.nl> Subject: [PATCH v1 01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type Date: Wed, 7 Dec 2022 21:03:38 +0200 Message-Id: <20221207190348.9347-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751583258763237769?= X-GMAIL-MSGID: =?utf-8?q?1751583258763237769?= |
Series |
[v1,01/11] iio: light: tsl2563: Do not hardcode interrupt trigger type
|
|
Commit Message
Andy Shevchenko
Dec. 7, 2022, 7:03 p.m. UTC
From: Ferry Toth <ftoth@exalondelft.nl> Instead of hardcoding IRQ trigger type to IRQF_TRIGGER_RAISING, let's respect the settings specified in the firmware description. To be compatible with the older firmware descriptions, if trigger type is not set up there, we'll set it to default (raising edge). Fixes: 388be4883952 ("staging:iio: tsl2563 abi fixes and interrupt handling") Fixes: bdab1001738f ("staging:iio:light:tsl2563 remove old style event registration.") Signed-off-by: Ferry Toth <ftoth@exalondelft.nl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/iio/light/tsl2563.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Comments
On Wed, 7 Dec 2022 21:03:38 +0200 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > From: Ferry Toth <ftoth@exalondelft.nl> > > Instead of hardcoding IRQ trigger type to IRQF_TRIGGER_RAISING, > let's respect the settings specified in the firmware description. > To be compatible with the older firmware descriptions, if trigger > type is not set up there, we'll set it to default (raising edge). > > Fixes: 388be4883952 ("staging:iio: tsl2563 abi fixes and interrupt handling") > Fixes: bdab1001738f ("staging:iio:light:tsl2563 remove old style event registration.") > Signed-off-by: Ferry Toth <ftoth@exalondelft.nl> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Andy, would have preferred a cover letter, so I had an obvious place to reply to the whole series... Mostly I'm amazed anyone still has one of these devices (I have one but it's on a break out board for the stargate2/imote2 pxa27x platform that we dropped support for last year - I hadn't booted it for a few years) - I can probably bodge it onto something else but I can't say it was high on my todo list ;) So nice to know that someone still cares about this. So I'm curious Ferry, what device has one of these? Whole series applied to the togreg branch of iio.git though note I'll only push this out as testing for now because I'll want to rebase that tree after rc1 is available. Thanks, Jonathan > --- > drivers/iio/light/tsl2563.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c > index d0e42b73203a..71302ae864d9 100644 > --- a/drivers/iio/light/tsl2563.c > +++ b/drivers/iio/light/tsl2563.c > @@ -704,6 +704,7 @@ static int tsl2563_probe(struct i2c_client *client) > struct iio_dev *indio_dev; > struct tsl2563_chip *chip; > struct tsl2563_platform_data *pdata = client->dev.platform_data; > + unsigned long irq_flags; > int err = 0; > u8 id = 0; > > @@ -759,10 +760,15 @@ static int tsl2563_probe(struct i2c_client *client) > indio_dev->info = &tsl2563_info_no_irq; > > if (client->irq) { > + irq_flags = irq_get_trigger_type(client->irq); > + if (irq_flags == IRQF_TRIGGER_NONE) > + irq_flags = IRQF_TRIGGER_RISING; > + irq_flags |= IRQF_ONESHOT; > + > err = devm_request_threaded_irq(&client->dev, client->irq, > NULL, > &tsl2563_event_handler, > - IRQF_TRIGGER_RISING | IRQF_ONESHOT, > + irq_flags, > "tsl2563_event", > indio_dev); > if (err) {
Hi, Op 11-12-2022 om 14:26 schreef Jonathan Cameron: > On Wed, 7 Dec 2022 21:03:38 +0200 > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > >> From: Ferry Toth <ftoth@exalondelft.nl> >> >> Instead of hardcoding IRQ trigger type to IRQF_TRIGGER_RAISING, >> let's respect the settings specified in the firmware description. >> To be compatible with the older firmware descriptions, if trigger >> type is not set up there, we'll set it to default (raising edge). >> >> Fixes: 388be4883952 ("staging:iio: tsl2563 abi fixes and interrupt handling") >> Fixes: bdab1001738f ("staging:iio:light:tsl2563 remove old style event registration.") >> Signed-off-by: Ferry Toth <ftoth@exalondelft.nl> >> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > Andy, would have preferred a cover letter, so I had an obvious place > to reply to the whole series... > > Mostly I'm amazed anyone still has one of these devices (I have one but > it's on a break out board for the stargate2/imote2 pxa27x platform that we > dropped support for last year - I hadn't booted it for a few years) > - I can probably bodge it onto something else but I can't say it was > high on my todo list ;) So nice to know that someone still cares about > this. > > So I'm curious Ferry, what device has one of these? It's a breakout board too. I think it's something like GY-2561. I wanted to write up an example how to get connect iio sensors to work with linux. So I asked my colleague who is a great fan of aliexpress if he had any sensor on a breakout board with I2C. In the past I had it working with MRAA and UPM but that seems to be a dead end now. We have ACPI working on Intel Edison-Arduino with quite a few examples from Andy. And the "Arduino" header makes it very easy to wire up these kind of breakout boards, fantastic platform this type of developments. Just wiring up the I2C and get it to work was easy enough. And then the interrupt pin makes an interesting example (even though likely useless for most applications of the light sensor). Write-up here if you are interested: https://htot.github.io/meta-intel-edison/4.6-libiio.html > Whole series applied to the togreg branch of iio.git though note I'll only > push this out as testing for now because I'll want to rebase that tree > after rc1 is available. > > Thanks, > > Jonathan > >> --- >> drivers/iio/light/tsl2563.c | 8 +++++++- >> 1 file changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c >> index d0e42b73203a..71302ae864d9 100644 >> --- a/drivers/iio/light/tsl2563.c >> +++ b/drivers/iio/light/tsl2563.c >> @@ -704,6 +704,7 @@ static int tsl2563_probe(struct i2c_client *client) >> struct iio_dev *indio_dev; >> struct tsl2563_chip *chip; >> struct tsl2563_platform_data *pdata = client->dev.platform_data; >> + unsigned long irq_flags; >> int err = 0; >> u8 id = 0; >> >> @@ -759,10 +760,15 @@ static int tsl2563_probe(struct i2c_client *client) >> indio_dev->info = &tsl2563_info_no_irq; >> >> if (client->irq) { >> + irq_flags = irq_get_trigger_type(client->irq); >> + if (irq_flags == IRQF_TRIGGER_NONE) >> + irq_flags = IRQF_TRIGGER_RISING; >> + irq_flags |= IRQF_ONESHOT; >> + >> err = devm_request_threaded_irq(&client->dev, client->irq, >> NULL, >> &tsl2563_event_handler, >> - IRQF_TRIGGER_RISING | IRQF_ONESHOT, >> + irq_flags, >> "tsl2563_event", >> indio_dev); >> if (err) { >
diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index d0e42b73203a..71302ae864d9 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c @@ -704,6 +704,7 @@ static int tsl2563_probe(struct i2c_client *client) struct iio_dev *indio_dev; struct tsl2563_chip *chip; struct tsl2563_platform_data *pdata = client->dev.platform_data; + unsigned long irq_flags; int err = 0; u8 id = 0; @@ -759,10 +760,15 @@ static int tsl2563_probe(struct i2c_client *client) indio_dev->info = &tsl2563_info_no_irq; if (client->irq) { + irq_flags = irq_get_trigger_type(client->irq); + if (irq_flags == IRQF_TRIGGER_NONE) + irq_flags = IRQF_TRIGGER_RISING; + irq_flags |= IRQF_ONESHOT; + err = devm_request_threaded_irq(&client->dev, client->irq, NULL, &tsl2563_event_handler, - IRQF_TRIGGER_RISING | IRQF_ONESHOT, + irq_flags, "tsl2563_event", indio_dev); if (err) {