From patchwork Tue Jan 17 00:52:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 91592 Delivered-To: patches@linaro.org Received: by 10.140.20.99 with SMTP id 90csp267297qgi; Mon, 16 Jan 2017 16:52:59 -0800 (PST) X-Received: by 10.99.101.65 with SMTP id z62mr43793746pgb.74.1484614379004; Mon, 16 Jan 2017 16:52:59 -0800 (PST) Return-Path: Received: from mail-pg0-x231.google.com (mail-pg0-x231.google.com. [2607:f8b0:400e:c05::231]) by mx.google.com with ESMTPS id d17si5708909pgh.312.2017.01.16.16.52.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jan 2017 16:52:58 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c05::231 as permitted sender) client-ip=2607:f8b0:400e:c05::231; 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::231 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-pg0-x231.google.com with SMTP id 14so19506042pgg.1 for ; Mon, 16 Jan 2017 16:52:58 -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=sWjlHfkAdFPS7THvUnxewh0hlmeuHPyRDdSMGB2nyb0=; b=MRDjhUhC2FOXq2OPuRfJVkOt1BElZwYgmcNmaxj450YHTpixPV+wOpEiNyW4OBW5Hp TmSCiJvvaMnkyQtciLcGwqEzm+ffymWN+Y12Vf3wrVcKhnuHIxNLR1CNDRM9BgtdZiiJ AZrXzn8Ax7DGAiMF4JEYD5LVPhcN+CSVce1bE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sWjlHfkAdFPS7THvUnxewh0hlmeuHPyRDdSMGB2nyb0=; b=ftxi1c5vBGWFP3ox8lEGpHtXEwUr+uCq7d0qo2HMvhGoEczv4bDXIncJ2jLbXKdZ71 Js1++lfu3/gNZvicBU5epcYcUhgRgnzmzRDgZSJDevilgpboYyUXZOnMnh50iwZrgQNE bBS7aG62UkCgCF/faRWkkd2WVGoEJcNzVinBnRfuvgRqTX0bqHezSYCNQeuJu5iI8giz P183Oe0lTD6EY3AzNGZu9U2fOSRhV1B/VymX99q5u7MkGmHE/kTvgFgGvJmU0WICk6gu e9RKinDXFvk4sQvrulcqALr9Vp8xt/4iiXomNw6qyEv0PVA7roDz4NBjSkmw0ucezPw/ Uzag== X-Gm-Message-State: AIkVDXJz57XnkwbbEZWQYpNwJBR1IFtlOcpXHxypOIgIYcy3sI0jXohF2RUnAs6Cn47J7YrsNm0= X-Received: by 10.98.134.2 with SMTP id x2mr40967057pfd.158.1484614378737; Mon, 16 Jan 2017 16:52:58 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id q19sm50220516pfl.21.2017.01.16.16.52.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Jan 2017 16:52:58 -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: [PATCH 2/6] drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event() Date: Mon, 16 Jan 2017 16:52:48 -0800 Message-Id: <1484614372-15342-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484614372-15342-1-git-send-email-john.stultz@linaro.org> References: <1484614372-15342-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 Reviewed-by: Laurent Pinchart Tested-by: Laurent Pinchart Signed-off-by: John Stultz --- v3: Update connector.status value and only call __hotplug_event() when that status changes, as suggested by Laurent. v4: Set adv7511->connector.status before calling adv7511->connector.status, 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..7b2b5af 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; - drm_helper_hpd_irq_event(adv7511->connector.dev); + 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) { + adv7511->connector.status = status; + drm_kms_helper_hotplug_event(adv7511->connector.dev); + } } static int adv7511_irq_process(struct adv7511 *adv7511, bool process_hpd)