Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp267107pxb; Mon, 8 Nov 2021 13:18:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJySg8eDO9CSIh2zOlQGgn7JtOCIvPEaX8K2kLPWpkU3KMIzTU+fzY7QF5bWJJY8R4qDM2Eg X-Received: by 2002:a17:906:1450:: with SMTP id q16mr2911903ejc.213.1636406325895; Mon, 08 Nov 2021 13:18:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636406325; cv=none; d=google.com; s=arc-20160816; b=xdGUsqjmbBda/+ZwLkB4n5XeWsJFizRxaBx6kyzX1BJpqPrJbk6ePDAYSDpstl9rgy 474DvfN1nhJVfLU9Aa2BtXtFee6KGRPeYnkFdSZXVOBTLm7jzloLjyRjVm0eA92IJ+sm 5z4DkIJEYq7WqcP+Z9H8CHcKlILwNJz0GoJ82Vsgw5+pObAQythku0GgshgwnFeSxPYN 1GpYOZ6QJD2MOdqqYSJ5/VhI48YRkd14tQyXV1S5RMXYrunGGj9oMMUd7UAzj/8c/ZVz dOG/7/4O/4nYitPsrhnKr8lAKt3ufaJIi9itfN11ZG3Jvxqi8ID80UGE4GH3Jzo3IxwR Y7bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=c1o8VuFV0ex5mfdL4xyBALnF6n9F6qHpOK09h+9rf8g=; b=MQ+xsqLZb7fC00RagaR0ZE8BabefnSeYcLg5Ht9EmdXbCQ0iE7M8PFQNqbuKgDL8JX n3WD8VQ6qnuDEbKuRDCI8W9wYS7zynMz0kT8Iek5L1MdYQUSBkhZAr8aY31/BEsJ//LN WwHdIgAHbtTQjPyb/r7qIu7t5GtKt7IUBqelGgVrdiqqkNYiC8l51+L15LwrJW664a3Y euKyGGnUcKu4V+WcDew19vmBdN6QMB/CuC03egrI6aj2GNFQtCGlwZiOnhB6mD7mR+bU xL+PMf2DRNWXWf497qHNsVG3jZivgHc5orP9kBL26jVMI+7wphnP2ST1UgobTEMTtiw4 fa/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H27fZX1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id b2si26943013ejp.225.2021.11.08.13.18.17; Mon, 08 Nov 2021 13:18:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=H27fZX1z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237422AbhKHPTF (ORCPT + 99 others); Mon, 8 Nov 2021 10:19:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231127AbhKHPTE (ORCPT ); Mon, 8 Nov 2021 10:19:04 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD4BBC061570; Mon, 8 Nov 2021 07:16:19 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id o8so63794735edc.3; Mon, 08 Nov 2021 07:16:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=c1o8VuFV0ex5mfdL4xyBALnF6n9F6qHpOK09h+9rf8g=; b=H27fZX1z/J39dmx5ZvhB+Zjd/Ahz3nOLNMPA8vLb8Xm2jJ5NNDOIMTtHe090eOtOFU DD/UFLFvddxNItBc/qNVrzgLM6s1d5nsbc2ES0evNQ/4s+72n9mcaXT8RZv4BAF1RY7b szvrS6jfzexdx1T0N3WH4x2FaM6GOZHKStAmaO5A0sC6qsgJTzq/XVKQsAug0VRcYzII pbrCWxDiWV2Z6iJos5t6YZ3i3NRnMBhkA9iIjCLQtZl6xCLBChO26K5O3b/CAydNqhOg IHtuS/bODnqA6Ck7F1ffSd98H9bH6xwC4SPb+E4MDBdZBYGszCkHQaKIMFM1Xu9qxZX/ DhTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=c1o8VuFV0ex5mfdL4xyBALnF6n9F6qHpOK09h+9rf8g=; b=3bswvzK28r6EXMOtC4iJzId/TQ4tii5U+EAu8MIHH8Im0ghIUxKzEtLxHTWcQh/jPi UZO85VgRzH3G+mWxmd59VoMawiJG07RH4cOujp7YwPrKD9A0mJY2XxEibqSexDoaButD tJWSX2SiZFAxpLpGz0Arv4XOLz18YG9cefk/PVXhj8hwgvXmgQ5411pVbR3wsxFVkZk4 +uV8gvAUo+EEE0b58d9NXrnpbeudCq44lB8cXzaxQhPysVHNTkfGL0PngV1dIcxjloaS bmeDtk6jhfYsQST/zYz+NVlUMV/Er+f3X2Emh+H8mf9GJlE1WEgOuKyc6ws5YM3ePCl9 q/9Q== X-Gm-Message-State: AOAM531xxhCvjChCJR0P82yOyCz3MHmCyK3R7Ppi1TKnDjxci+jV/BKl +XS6ZE1nyFdtAYDHLOZkg/M= X-Received: by 2002:a17:906:c156:: with SMTP id dp22mr103436ejc.168.1636384578278; Mon, 08 Nov 2021 07:16:18 -0800 (PST) Received: from Ansuel-xps.localdomain (93-42-71-246.ip85.fastwebnet.it. [93.42.71.246]) by smtp.gmail.com with ESMTPSA id n1sm9216809edf.45.2021.11.08.07.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 07:16:18 -0800 (PST) Date: Mon, 8 Nov 2021 16:16:13 +0100 From: Ansuel Smith To: Andrew Lunn Cc: Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Rob Herring , Jonathan Corbet , Pavel Machek , John Crispin , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-leds@vger.kernel.org, Marek =?iso-8859-1?Q?Beh=FAn?= Subject: Re: [RFC PATCH v2 1/5] leds: trigger: add API for HW offloading of triggers Message-ID: References: <20211108002500.19115-1-ansuelsmth@gmail.com> <20211108002500.19115-2-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 03:04:23PM +0100, Andrew Lunn wrote: > > +static inline int led_trigger_offload(struct led_classdev *led_cdev) > > +{ > > + int ret; > > + > > + if (!led_cdev->trigger_offload) > > + return -EOPNOTSUPP; > > + > > + ret = led_cdev->trigger_offload(led_cdev, true); > > + led_cdev->offloaded = !ret; > > + > > + return ret; > > +} > > + > > +static inline void led_trigger_offload_stop(struct led_classdev *led_cdev) > > +{ > > + if (!led_cdev->trigger_offload) > > + return; > > + > > + if (led_cdev->offloaded) { > > + led_cdev->trigger_offload(led_cdev, false); > > + led_cdev->offloaded = false; > > + } > > +} > > +#endif > > I think there should be two calls into the cdev driver, not this > true/false parameter. trigger_offload_start() and > trigger_offload_stop(). > To not add too much function to the struct, can we introduce one function that both enable and disable the hw mode? > There are also a number of PHYs which don't allow software blinking of > the LED. So for them, trigger_offload_stop() is going to return > -EOPNOTSUPP. And you need to handle that correctly. > So we have PHYs that can only work in offload or off. Correct? > It would be go to also document the expectations of > trigger_offload_stop(). Should it leave the LED in whatever state it > was, or force it off? > I think it should be put off. Do you agree? (also the brightness should be set to 0 in this case) > Andrew -- Ansuel