* Re: [PATCH V7 6/6] backlight: qcom-wled: Add auto string detection logic [not found] ` <20191017133024.GQ4365@dell> @ 2019-10-18 5:03 ` kgunda 0 siblings, 0 replies; 2+ messages in thread From: kgunda @ 2019-10-18 5:03 UTC (permalink / raw) To: Lee Jones Cc: bjorn.andersson, jingoohan1, b.zolnierkie, dri-devel, daniel.thompson, jacek.anaszewski, pavel, robh+dt, mark.rutland, linux-leds, devicetree, linux-kernel, Andy Gross, linux-arm-msm, linux-fbdev, linux-arm-msm-owner On 2019-10-17 19:00, Lee Jones wrote: > On Thu, 17 Oct 2019, kgunda@codeaurora.org wrote: > >> On 2019-10-17 17:56, Lee Jones wrote: >> > On Wed, 16 Oct 2019, Kiran Gunda wrote: >> > >> > > The auto string detection algorithm checks if the current WLED >> > > sink configuration is valid. It tries enabling every sink and >> > > checks if the OVP fault is observed. Based on this information >> > > it detects and enables the valid sink configuration. >> > > Auto calibration will be triggered when the OVP fault interrupts >> > > are seen frequently thereby it tries to fix the sink configuration. >> > > >> > > The auto-detection also kicks in when the connected LED string >> > > of the display-backlight malfunctions (because of damage) and >> > > requires the damaged string to be turned off to prevent the >> > > complete panel and/or board from being damaged. >> > > >> > > Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> >> > > --- >> > > drivers/video/backlight/qcom-wled.c | 410 >> > > +++++++++++++++++++++++++++++++++++- >> > > 1 file changed, 404 insertions(+), 6 deletions(-) >> > > >> > > diff --git a/drivers/video/backlight/qcom-wled.c >> > > b/drivers/video/backlight/qcom-wled.c >> > > index b5b125c..ff7c409 100644 >> > > --- a/drivers/video/backlight/qcom-wled.c >> > > +++ b/drivers/video/backlight/qcom-wled.c > > [...] > >> > > + if (int_sts & WLED3_CTRL_REG_OVP_FAULT_STATUS) >> > > + dev_dbg(wled->dev, "WLED OVP fault detected with SINK %d\n", >> > > + i + 1); >> > >> > I haven't reviewed the whole patch, but this caught my eye. >> > >> > I think this should be upgraded to dev_warn(). >> > >> Thought of keeping these messages silent, Because the string >> configuration >> will be corrected in this >> and informing it at end of the auto string detection. > > [...] > >> > > + } else { >> > > + dev_warn(wled->dev, "New WLED string configuration found %x\n", >> > > + sink_valid); >> > >> > Why would the user care about this? Is it not normal? >> > >> Actually, it comes here if the user provided string configuration in >> the >> device tree is in-correct. >> That's why just informing the user about the right string >> configuration, >> after the auto string detection. > > Then I think we need to be more forthcoming. Tell the user the > configuration is incorrect and what you've done to rectify it. > > "XXX is not a valid configuration - using YYY instead" > Sure. Will update it in the next series. > [...] > >> > > +static int wled_configure_ovp_irq(struct wled *wled, >> > > + struct platform_device *pdev) >> > > +{ >> > > + int rc; >> > > + u32 val; >> > > + >> > > + wled->ovp_irq = platform_get_irq_byname(pdev, "ovp"); >> > > + if (wled->ovp_irq < 0) { >> > > + dev_dbg(&pdev->dev, "ovp irq is not used\n"); >> > >> > I assume this is optional. What happens if no IRQ is provided? >> > >> Here OVP IRQ is used to detect the wrong string detection. If it is >> not >> provided the auto string detection logic won't work. > > "OVP IRQ not found - disabling automatic string detection" > Sure. Will update it in the next series. >> > If, for instance, polling mode is enabled, maybe something like this >> > would be better? >> > >> > dev_warn(&pdev->dev, "No IRQ found, falling back to polling >> > mode\n"); ^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <20191017112941.qqvgboyambzw63i3@holly.lan>]
[parent not found: <fa32f7ec727cb2626ad877a6cef32a1b@codeaurora.org>]
[parent not found: <20191017133954.7vgqjgwxojmjw446@holly.lan>]
* Re: [PATCH V7 6/6] backlight: qcom-wled: Add auto string detection logic [not found] ` <20191017133954.7vgqjgwxojmjw446@holly.lan> @ 2019-10-18 6:42 ` kgunda 0 siblings, 0 replies; 2+ messages in thread From: kgunda @ 2019-10-18 6:42 UTC (permalink / raw) To: Daniel Thompson Cc: bjorn.andersson, jingoohan1, lee.jones, b.zolnierkie, dri-devel, jacek.anaszewski, pavel, robh+dt, mark.rutland, linux-leds, devicetree, linux-kernel, Andy Gross, linux-arm-msm, linux-fbdev, linux-arm-msm-owner On 2019-10-17 19:09, Daniel Thompson wrote: > On Thu, Oct 17, 2019 at 05:47:47PM +0530, kgunda@codeaurora.org wrote: >> On 2019-10-17 16:59, Daniel Thompson wrote: >> > On Wed, Oct 16, 2019 at 03:43:46PM +0530, Kiran Gunda wrote: >> > > The auto string detection algorithm checks if the current WLED >> > > sink configuration is valid. It tries enabling every sink and >> > > checks if the OVP fault is observed. Based on this information >> > > it detects and enables the valid sink configuration. >> > > Auto calibration will be triggered when the OVP fault interrupts >> > > are seen frequently thereby it tries to fix the sink configuration. >> > > >> > > The auto-detection also kicks in when the connected LED string >> > > of the display-backlight malfunctions (because of damage) and >> > > requires the damaged string to be turned off to prevent the >> > > complete panel and/or board from being damaged. >> > > >> > > Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> >> > >> > It's a complex bit of code but I'm OK with it in principle. Everything >> > below is about small details and/or nitpicking. >> > >> > >> > > +static void wled_ovp_work(struct work_struct *work) >> > > +{ >> > > + struct wled *wled = container_of(work, >> > > + struct wled, ovp_work.work); >> > > + enable_irq(wled->ovp_irq); >> > > +} >> > > + >> > >> > A bit of commenting about why we have to wait 10ms before enabling the >> > OVP interrupt would be appreciated. >> > >> > >> Sure. Will add the comment in the next series. >> > > +static irqreturn_t wled_ovp_irq_handler(int irq, void *_wled) >> > > +{ >> > > + struct wled *wled = _wled; >> > > + int rc; >> > > + u32 int_sts, fault_sts; >> > > + >> > > + rc = regmap_read(wled->regmap, >> > > + wled->ctrl_addr + WLED3_CTRL_REG_INT_RT_STS, &int_sts); >> > > + if (rc < 0) { >> > > + dev_err(wled->dev, "Error in reading WLED3_INT_RT_STS rc=%d\n", >> > > + rc); >> > > + return IRQ_HANDLED; >> > > + } >> > > + >> > > + rc = regmap_read(wled->regmap, wled->ctrl_addr + >> > > + WLED3_CTRL_REG_FAULT_STATUS, &fault_sts); >> > > + if (rc < 0) { >> > > + dev_err(wled->dev, "Error in reading WLED_FAULT_STATUS rc=%d\n", >> > > + rc); >> > > + return IRQ_HANDLED; >> > > + } >> > > + >> > > + if (fault_sts & >> > > + (WLED3_CTRL_REG_OVP_FAULT_BIT | WLED3_CTRL_REG_ILIM_FAULT_BIT)) >> > > + dev_dbg(wled->dev, "WLED OVP fault detected, int_sts=%x >> > > fault_sts= %x\n", >> > > + int_sts, fault_sts); >> > > + >> > > + if (fault_sts & WLED3_CTRL_REG_OVP_FAULT_BIT) { >> > > + mutex_lock(&wled->lock); >> > > + disable_irq_nosync(wled->ovp_irq); >> > >> > We're currently running the threaded ISR for this irq. Do we really need >> > to disable it? >> > >> We need to disable this IRQ, during the auto string detection logic. >> Because >> in the auto string detection we configure the current sinks one by one >> and >> check the >> status register for the OVPs and set the right string configuration. >> We >> enable it later after >> the auto string detection is completed. > > This is a threaded oneshot interrupt handler. Why isn't the framework > masking sufficient for you here? > > > Daniel. Right .. I overlooked that it is a oneshot interrupt earlier. I will address it in the next series. ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-18 6:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1571220826-7740-1-git-send-email-kgunda@codeaurora.org>
[not found] ` <1571220826-7740-7-git-send-email-kgunda@codeaurora.org>
[not found] ` <20191017122653.GO4365@dell>
[not found] ` <689831a9d7561f51cdb7ea0a1760d472@codeaurora.org>
[not found] ` <20191017133024.GQ4365@dell>
2019-10-18 5:03 ` [PATCH V7 6/6] backlight: qcom-wled: Add auto string detection logic kgunda
[not found] ` <20191017112941.qqvgboyambzw63i3@holly.lan>
[not found] ` <fa32f7ec727cb2626ad877a6cef32a1b@codeaurora.org>
[not found] ` <20191017133954.7vgqjgwxojmjw446@holly.lan>
2019-10-18 6:42 ` kgunda
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).