Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4174202ybl; Mon, 9 Dec 2019 06:39:26 -0800 (PST) X-Google-Smtp-Source: APXvYqxc10wI53hscrDEe7b9gEiwwO43ghr1FArXyrpYIfmkoJbdu47u0em9RGEiVDMEPhJLV+Jc X-Received: by 2002:a05:6830:14d5:: with SMTP id t21mr20843102otq.324.1575902365940; Mon, 09 Dec 2019 06:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575902365; cv=none; d=google.com; s=arc-20160816; b=DGS60kdVqTlkNLNIp99o+bGUz+93hXMePrDWh0ZjIJ1LBJHWN5v2wlZcXcsbmTcv1a AiIGzTALoIykWN0AWd2YfjphRw4IQipCRbCE7qGgZxf6Jt1xZMpYZkB9asFc0eA4C++x lhlVNH1184IPiooSPV8nXqQGBd8ihf0/VxgwzO+ODJhrQgiOXISXzmpAzoxGSmLsQtLx DXeXt8xi4Mb+Ug+SgImg29G/QSnvXVXsKlCa+APNNbKAjlTa76lVGhWfMC211UTedgic uCF39xKCFbcHiei/ZOGZQ5b+7ln2FQ9n6tXqr359i8lQXnKEv0zgjfnTe/UVaiTqwdpF Skog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=H7XZjgL3g7KTwVnmufmCC7R6OVK7fHUfMBsGrRCsy1I=; b=ObkRVfW6NUyefpKTG84jvxgWASS95M+Exi41tQFYcR9kTWc2mQkvJ8MC2krVTm4DrL JJTrdxkmkPi1w1onSbf6HrT19fqqjQdMX6jb9kl9izTBrNdW++8cvGa95uddBeuNC6On t7KIJMb+ZuhuiiYT5q6J21XxP16MopK4U0IXqgn0EBQB5UZpEAhaLmnCWImG1MpFYzr2 fJMBfbiOY6KLJQB/XCdZghnVwdcXtYpkngoWA6U52pB/RJ1ci/t7TiaMHCQ9bgGR2mOr mDkQXwb3xqqGZv5p2aZO5Bb7VJPdh8gNqIx3asu6UNzZT+A0uAuD+0oeysUXaGV0fukk Dn+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UnqlV9gQ; 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 n23si12188592otf.265.2019.12.09.06.39.14; Mon, 09 Dec 2019 06:39:25 -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=UnqlV9gQ; 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 S1727650AbfLIOi3 (ORCPT + 99 others); Mon, 9 Dec 2019 09:38:29 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:37895 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbfLIOi3 (ORCPT ); Mon, 9 Dec 2019 09:38:29 -0500 Received: by mail-qk1-f193.google.com with SMTP id k6so13207940qki.5 for ; Mon, 09 Dec 2019 06:38:28 -0800 (PST) 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; bh=H7XZjgL3g7KTwVnmufmCC7R6OVK7fHUfMBsGrRCsy1I=; b=UnqlV9gQIodeEiMkvWAZgaYU12yntYX3jw83zfinkFdaoCjrGa13NrFjSaMRF4enzO ZEoRx3U62+07LE1c0XeEr7Imkg7qlSnZtktjCWrj1ggRQLQmam1DmOID7VHcwh4GhLHb NeqMHl/BCMHfsMKT0PO6fRkp3PuMWmmbb9jvvgIF4Zd41hrZgER4mC+IvxJF/wwUjU2c XeAOb3q9NcP+2f8uQvs00RvKGzE0KECrVuZotHBFoBdblnfM36t+8Il5kIGRwThIFAa9 r5+5Mis2aUsJk+fmTRx1XIxCpqPAKPuD0jd6luoN/JArA7vCpWbdTr/fA7y/dn6UiBBZ eZug== 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; bh=H7XZjgL3g7KTwVnmufmCC7R6OVK7fHUfMBsGrRCsy1I=; b=gdtKqSTMeyUrh6n4kwegCRQeHZU4VhZgUrRJdyzlFdkSJusPNXRcrVkUiWiA+UvBW+ yxC4OYOBNBmVuSrkBSACQ1yaI49VCYjGx4J0gqU9qpX8zWj5Pg/vJghHVxMEIG2u+1z2 OzLM8o2Zp/X8BeMgtkyI4xqxE029Yb27hEhMmAqQz/aUkkJbrkecYCHZsAhGW508zOSu 6oGg1MKnuddFBHFbNCHAWbNBLbGj0bsFLk6XdM2e1KAVFGxte/t1SDYkoMGU5nSfWfiy PpqYUb35yPW0laKSsgaUNgSNdS8/mM8F+cuDTxLSEzk2BTQ5PlupAvkvAciAkpg8dYOF LeoA== X-Gm-Message-State: APjAAAV8bUA0wZzaE0fRgqHM1SuzP76S6HFd77xqaRhI300WRDLk6iYQ uNWakv6ydepwnUJ5ku8zB1iOObjssPE6lvtCoto= X-Received: by 2002:a37:9245:: with SMTP id u66mr28555486qkd.102.1575902308099; Mon, 09 Dec 2019 06:38:28 -0800 (PST) MIME-Version: 1.0 References: <20191209050857.31624-1-andrew.smirnov@gmail.com> <20191209050857.31624-3-andrew.smirnov@gmail.com> <45afdff8-4f91-f5be-a299-d0c7fed71ea7@ti.com> In-Reply-To: <45afdff8-4f91-f5be-a299-d0c7fed71ea7@ti.com> From: Andrey Smirnov Date: Mon, 9 Dec 2019 06:38:16 -0800 Message-ID: Subject: Re: [PATCH v3 2/2] drm/bridge: tc358767: Expose test mode functionality via debugfs To: Tomi Valkeinen Cc: dri-devel@lists.freedesktop.org, Andrzej Hajda , Laurent Pinchart , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel , Daniel Vetter Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 9, 2019 at 1:38 AM Tomi Valkeinen wrote: > > (Cc'ing Daniel for the last paragraph) > > On 09/12/2019 07:08, Andrey Smirnov wrote: > > Presently, the driver code artificially limits test pattern mode to a > > single pattern with fixed color selection. It being a kernel module > > parameter makes switching "test pattern" <-> "proper output" modes > > on-the-fly clunky and outright impossible if the driver is built into > > the kernel. > > That's not correct, /sys/module/tc358767/parameters/test is there even if the driver is built-in. > True, I'll drop the "impossible" part of the descrption. Having to unbind and bind device to the driver to use that parameter definitely falls under "clunky" for me still, so I'll just stick to that in the description. > I think the bigger problems are that there's just one value, even if there are multiple devices, and > that with kernel parameter the driver can't act on it dynamically (afaik). > > > To improve the situation a bit, convert current test pattern code to > > use debugfs instead by exposing "TestCtl" register. This way old > > "tc_test_pattern=1" functionality can be emulated via: > > > > echo -n 0x78146302 > tstctl > > > > and switch back to regular mode can be done with: > > > > echo -n 0x78146300 > tstctl > > In the comment in the code you have 0 as return-to-regular-mode. Both should work, but I'll modify commit message to match the code. > > With my setup, enabling test mode seems to work, but when I return to regular mode, the first echo > results in black display, but echoing 0 a second time will restore the display. > > Hmm, actually, just echoing 0 to tstctl multiple times, it makes the screen go black and then > restores it with every other echo. > Strange, works on my setup every time. No error messages in kernel log I assume? Probably unrelated, but when you echo "0" and the screen stays black, what do you see in DP_SINK_STATUS register: dd if=/dev/drm_dp_aux0 bs=1 skip=$((0x205)) count=1 2>/dev/null | hexdump -Cv ? Note that this needs CONFIG_DRM_DP_AUX_CHARDEV to be enabled. > > + debugfs = debugfs_create_dir(dev_name(dev), NULL); > > + if (!IS_ERR(debugfs)) { > > + debugfs_create_file_unsafe("tstctl", 0200, debugfs, tc, > > + &tc_tstctl_fops); > > + devm_add_action_or_reset(dev, tc_remove_debugfs, debugfs); > > + } > > + > > For me this creates debugfs/3-000f/tstctl. I don't think that's a clear or usable path, and could > even cause a name conflict in the worst case. > I agree on usability aspect, but I am not sure I can see how a conflict can happen. What scenario do you have in mind that would cause that? My thinking was that the combination of I2C bus number + I2C address should always be unique on the system, but maybe I am missing something? > Not sure what's a good solution here, but only two semi-good ones come to mind: have it in sysfs > under the device's dir, I'm fine with this option if it is the only path forward, but, given a choice, I would _really_ rather not go the sysfs route. Thanks, Andrey Smirnov