From patchwork Mon Dec 12 21:00:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 87769 Delivered-To: patches@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1858658qgi; Mon, 12 Dec 2016 13:00:47 -0800 (PST) X-Received: by 10.84.197.165 with SMTP id n34mr191524313pld.34.1481576447776; Mon, 12 Dec 2016 13:00:47 -0800 (PST) Return-Path: Received: from mail-pg0-x232.google.com (mail-pg0-x232.google.com. [2607:f8b0:400e:c05::232]) by mx.google.com with ESMTPS id k1si45055260pld.26.2016.12.12.13.00.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 13:00:47 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::232 as permitted sender) client-ip=2607:f8b0:400e:c05::232; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::232 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x232.google.com with SMTP id f188so39012012pgc.3 for ; Mon, 12 Dec 2016 13:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EWT1/2E/Jy2+pBKgM/aaeeaZVzlNMxLNL5ypvQtBCwk=; b=esmlUkfBg7zQ+Tpq/x8H4o1ei4Bzjp/waoVv0h5QMZ7OnO92xFQ8Dng/v2NwRpYKPI Lwl2wJ62cJow2bcobUua67QMs5U9ANh6sxEPtJYtb7XwJ/Wb0u1+4PmXjJCyuWBN6cfu 1X+tnNmEHUZyDnae428mVpzERDIgriZohDUl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EWT1/2E/Jy2+pBKgM/aaeeaZVzlNMxLNL5ypvQtBCwk=; b=CMmGdiE+j/7P4YDT8IO6X45c6spNqtyAjd9WTg8HywFdtB5Bh41KsTkGpcF+JwNJuz VgN5xEfxOCZyo8e4ygqXakafNGjax57HpyDIH27QX1EcrAoB+7cSCHePGMRSD2xoG780 JTZ9U+hwKj21lXST/8+TS+PcqKFVRCculO0hVYKnojiYiZ/3OQ/vxqr9DRbqHl/wfsOw QK0KOcjJzHkM9Lqbn1+JkH1vwBSlg+GK828m4AzIVGdsE5soRTJ4fP7ZxFJJDqhUB9F5 sbwYsUHCrf6U72fFcniuahCu4hlbfCcIGm6V1JfCXr7ssfp+eWTaROAs/xaYiyv3VJvQ qssA== X-Gm-Message-State: AKaTC029DLvAd3IPJFpq3V2mkdM+FEt/tNfK0/Tf2jpnY8hADO65G6xJCmnJdVWbIGHfNkJYvRo= X-Received: by 10.99.171.65 with SMTP id k1mr170401354pgp.87.1481576447340; Mon, 12 Dec 2016 13:00:47 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id f3sm41074078pga.45.2016.12.12.13.00.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Dec 2016 13:00:46 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , David Airlie , Archit Taneja , Wolfram Sang , Lars-Peter Clausen , Laurent Pinchart , dri-devel@lists.freedesktop.org Subject: [RFC][PATCH 2/5 v3] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event() Date: Mon, 12 Dec 2016 13:00:38 -0800 Message-Id: <1481576441-23529-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481576441-23529-1-git-send-email-john.stultz@linaro.org> References: <1481576441-23529-1-git-send-email-john.stultz@linaro.org> In chasing down a previous issue with EDID probing from calling drm_helper_hpd_irq_event() from irq context, Laurent noticed that the DRM documentation suggests that drm_kms_helper_hotplug_event() should be used instead. Thus this patch replaces drm_helper_hpd_irq_event() with drm_kms_helper_hotplug_event(), which requires we update the connector.status entry and only call _hotplug_event() when the status changes. Cc: David Airlie Cc: Archit Taneja Cc: Wolfram Sang Cc: Lars-Peter Clausen Cc: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org Signed-off-by: John Stultz --- v3: Update connector.status value and only call __hotplug_event() when that status changes, as suggested by Laurent. --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 4fcea44..d93d66f 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -405,8 +405,22 @@ static bool adv7511_hpd(struct adv7511 *adv7511) static void adv7511_hpd_work(struct work_struct *work) { struct adv7511 *adv7511 = container_of(work, struct adv7511, hpd_work); + enum drm_connector_status status; + unsigned int val; + int ret; + + ret = regmap_read(adv7511->regmap, ADV7511_REG_STATUS, &val); + if (ret < 0) + status = connector_status_disconnected; + else if (val & ADV7511_STATUS_HPD) + status = connector_status_connected; + else + status = connector_status_disconnected; + + if (adv7511->connector.status != status) + drm_kms_helper_hotplug_event(adv7511->connector.dev); - drm_helper_hpd_irq_event(adv7511->connector.dev); + adv7511->connector.status = status; } static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)