Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp78101pxk; Fri, 11 Sep 2020 00:25:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSVcxmvxj7AIzWgRWmKxJSrx3ILJ0XzN4eRrm9GiUDyto5wVu7ceSJkIxqx0IPuk+nap3Z X-Received: by 2002:aa7:c554:: with SMTP id s20mr648349edr.230.1599809146408; Fri, 11 Sep 2020 00:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599809146; cv=none; d=google.com; s=arc-20160816; b=a2rREfr/HyTJ6U4LpmeT6UgCwYsr8fQhror9+7PuGCZLXYezDEpgRxu+zZUQxSohlK 1llaiiXP1y4y+/EeJ4igFZKGkh6nLDtLpJFO+iapY1v6HVgkkeENx2Lsr7/Ww7EzxYR/ D9NWZtfvMX/BWrs6Jm4/rHvx06NsR6VdGtfNVpgbWPIhJ2FAkcuWMXyc9zwcV3bl9vp1 lSYhZDwp4iWWhJleqUL0yxoNnUoVRsQ3A0IGISSZn02aHWncxytZXjnVkcz1cc7fkPyd PVCFwtdYzkMhtCMHgGfdSDSvVDuao8lDMX9/8CAT5Yy6IrIph1vADY4r5JFIDM2dZNl9 141A== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yDDPYjQ6DUX6xXLMzgBfV6buP3oYPEgo+EN2kc6eWTY=; b=SmzpUpglV5K5sIDkOSZ+RJ8nbYK7wXFYWXzvmQpQ/YcwiW6BPvMD2wazpxX/xz0JqN wddcWVvzmBufVq4wWBs0cTBc1gnYNt+cy4vLldJHwbBDbR7wYy6vRwq7ochYyA/bf62y UQ2TVnZ4MEoiAhkJ1kZjZTr6dLbqEU3fLw/VmOozxWbX8d4kky0g1AUKyScMhcni9KvZ 7pve0frRbnzgqg/U2tm4xSbMnPwFCcApkmxdkAgalRwJKAVtShr3ZIhr9/i6zFyOyRHg X7p+9xytn2B1EZL2zQ/IKvUyRrKHvgW6TiCqfT/CWs+wWoYdXTESkGIBz4jtjzuTjwPX a5sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VCg1Rxdg; 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 v26si737526ejr.748.2020.09.11.00.25.23; Fri, 11 Sep 2020 00:25:46 -0700 (PDT) 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=20161025 header.b=VCg1Rxdg; 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 S1725783AbgIKHYs (ORCPT + 99 others); Fri, 11 Sep 2020 03:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgIKHYq (ORCPT ); Fri, 11 Sep 2020 03:24:46 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0C89C061573; Fri, 11 Sep 2020 00:24:45 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id u20so8162737ilk.6; Fri, 11 Sep 2020 00:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=yDDPYjQ6DUX6xXLMzgBfV6buP3oYPEgo+EN2kc6eWTY=; b=VCg1Rxdg/5MOXY5w9Loq/ArIKnhcyC7pdwtI0PJCD0vVfIdVBX+RvdOd1Q5EE/A53w HWGWf0JGtxHP61Zr4h8gH4j26j5SNSoxD3vtLuGw3a0z0WxP89DkWfDwDzZcnX1R76Ic jXruVD3rEZ4UXYCNvS2a7SCyOmZW8U+yp5ao+bAfosxKLd2YKefNhRYzjaJSwazSk08G v654syyecqb4nuwrs7j4hZIwCdFoj/l0Ei56xgFfWkIAn4dksivJxtmTJHXaJn+CYlHl YLMUqkbMZRmVZbV0VPKguJqZFYMyTDpGNyYxSUjXRJrxYEL6h6Dj3bXA5NYbLYpMKZqk ClfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=yDDPYjQ6DUX6xXLMzgBfV6buP3oYPEgo+EN2kc6eWTY=; b=RVJNr63JskiF1nzWeNemM12GGz8sZdEXjX/imBTGpV6I2pAjKqzhoXovUfvKTbQoug eD1vxldOAxSy8JPmWl3QvzLtH8XL1zmdr5cTsl4fbsObTsOnWWM2Wm4FnoJi9yK/8Cig d9X3WR9KKTa2i1x1pjw0cMx5zhDfDlbo0QUjiJ/S3Tl9a3NLYIbSVt/pKiCFmYD+tpfG xIE0/KfrS1f6pQ9QromsxXlZH/bqGQTVC2yrfv2EHAvCjkO5t0NE0jmx3hPA+ZuJ7H8e zOV4LLA85fmSLesqqlOn0WPWDeH3rbIVUYd0Yo0samsxygNx5U/unEKFtPeb4NuKtfmF iweg== X-Gm-Message-State: AOAM531s2oQbAggfVFLYaSm0UEWKtvRBFNwem3VviHcGnTxmkEmPq7x1 CWcLT1QQaQrwOS8UEuUciHI5Qazyr7SuGDFHQY/CAfNT3aM= X-Received: by 2002:a92:d1d1:: with SMTP id u17mr699311ilg.127.1599809083413; Fri, 11 Sep 2020 00:24:43 -0700 (PDT) MIME-Version: 1.0 References: <1599474459-20853-1-git-send-email-gene.chen.richtek@gmail.com> <1599474459-20853-2-git-send-email-gene.chen.richtek@gmail.com> <559a568e-3a2e-33c6-43aa-547a18f8e26b@gmail.com> <20200911070503.GA9818@amd> In-Reply-To: <20200911070503.GA9818@amd> From: Gene Chen Date: Fri, 11 Sep 2020 07:24:31 +0800 Message-ID: Subject: Re: [PATCH v3 1/2] leds: mt6360: Add LED driver for MT6360 To: Pavel Machek Cc: Jacek Anaszewski , robh+dt@kernel.org, Matthias Brugger , Dan Murphy , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Gene Chen , Wilma.Wu@mediatek.com, shufan_lee@richtek.com, cy_huang@richtek.com, benjamin.chao@mediatek.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pavel Machek =E6=96=BC 2020=E5=B9=B49=E6=9C=8811=E6=97=A5 = =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=883:05=E5=AF=AB=E9=81=93=EF=BC=9A > > Hi! > > > >+{ > > >+ struct mt6360_led *led =3D container_of(lcdev, struct mt6360_led,= flash.led_cdev); > > >+ struct mt6360_priv *priv =3D led->priv; > > >+ u32 enable_mask =3D MT6360_TORCHEN_MASK | MT6360_FLCSEN_MASK(led-= >led_no); > > >+ u32 val =3D (level) ? MT6360_FLCSEN_MASK(led->led_no) : 0; > > >+ u32 prev =3D priv->fled_torch_used, curr; > > >+ int ret; > > >+ > > >+ dev_dbg(lcdev->dev, "[%d] brightness %d\n", led->led_no, level); > > >+ if (priv->fled_strobe_used) { > > >+ dev_warn(lcdev->dev, "Please disable strobe first [%d]\n"= , priv->fled_strobe_used); > > > > Doesn't hardware handle that? IOW, what happens when you have enabled > > both torch and flash? If flash just overrides torch mode, than you > > should not prevent enabling torch in this case. > > Yep, this is strange/confusing... and was reason why I asked for not > supporting strobe from sysfs. > > Could I get you to remove code you are not commenting at when > reviewing? > MT6360 FLED register define is STROBE_EN/TORCH_EN/CS1/CS2 (current source) 4 bits. The STROBE_EN/TORCH_EN is shared by FLED1 and FLED2. If I want to enable FLED1 torch mode, I set TORCH_EN and CS1 If I want to enable FLED2 strobe mode, I set STROBE_EN and CS2 For example I set FLED1 torch, then I set FLED2 strobe. When I set FLED2 strobe, I will see the strobe current is FLED2 add FLED1 current which is not I want. So I need disable FLED1 torch first. Considering every circumstances is complicated when share same H/W logic control. And the other problem is torch mode switch to strobe mode needs ramp time because strobe and torch mode can't be co-exist. > > >+MODULE_AUTHOR("Gene Chen "); > > >+MODULE_DESCRIPTION("MT6360 Led Driver"); > > Led -> LED. > ACK > P= avel > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/b= log.html