From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750989AbdK2FGD (ORCPT ); Wed, 29 Nov 2017 00:06:03 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:50762 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbdK2FGB (ORCPT ); Wed, 29 Nov 2017 00:06:01 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1844E6024C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=architt@codeaurora.org Subject: Re: [RFC][PATCH] drm: adv7511/33: Fix adv7511_cec_init() failure handling To: John Stultz Cc: Arnd Bergmann , Laurent Pinchart , David Airlie , Lars-Peter Clausen , Bhumika Goyal , Inki Dae , dri-devel@lists.freedesktop.org, lkml , Xinliang Liu , Dan Carpenter , Sean Paul , Hans Verkuil , Guodong Xu References: <1510873179-20786-1-git-send-email-john.stultz@linaro.org> <6faf6790-c5a3-8ca7-eb51-115842a66ceb@codeaurora.org> From: Archit Taneja Message-ID: Date: Wed, 29 Nov 2017 10:35:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/29/2017 03:02 AM, John Stultz wrote: > On Sun, Nov 26, 2017 at 4:56 AM, Archit Taneja wrote: >> >> On 11/17/2017 04:29 AM, John Stultz wrote: >>> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >>> b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >>> index 0e14f15..939c3b9 100644 >>> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >>> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >>> @@ -1203,12 +1203,12 @@ static int adv7511_probe(struct i2c_client *i2c, >>> const struct i2c_device_id *id) >>> #ifdef CONFIG_DRM_I2C_ADV7511_CEC >>> ret = adv7511_cec_init(dev, adv7511, offset); >>> - if (ret) >>> - goto err_unregister_cec; >>> #else >>> - regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, >>> - ADV7511_CEC_CTRL_POWER_DOWN); >>> + ret = 1; >>> #endif >>> + if (ret) >>> + regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + >>> offset, >>> + ADV7511_CEC_CTRL_POWER_DOWN); >> >> >> This would force CEC to be powered off even if adv7511_cec_init() returned >> 0, right? > > I don't think so. The initent was its only powered off if > adv7511_cec_init returns an error or if CONFIG_DRM_I2C_ADV7511_CEC is > not set. > >> Do we know why the call to adv7511_cec_init() is failing on the Hikey board? >> If it's >> because there isn't a "cec" clock specified in DT, it's not really a fatal >> error, it >> just means that the platform hasn't been set up to support CEC. In that > > Yea. I believe this is the case w/ HiKey. I don't have deeply > detailed docs on the board so I'm not sure if we will be able to > enable that or not (Xinliang/Guodong: Do you know if its possible?). > In the meantime though, we shouldn't regress. > >> case, we >> should just power down the CEC block. So, if adv7511_cec_init() would return >> a >> -ENOENT, which we could use as a hint to power down CEC. So, maybe something >> like this?: >> >> #ifdef CONFIG_DRM_I2C_ADV7511_CEC >> ret = adv7511_cec_init(dev, adv7511, offset); >> if (ret && ret != -ENOENT) >> goto err_unregister_cec; >> #endif >> if (ret) >> regmap_write(adv7511->regmap, ADV7511_REG_CEC_CTRL + offset, >> ADV7511_CEC_CTRL_POWER_DOWN); >> >> Apart from this, we should also move adv7511_cec_init() up in the probe so >> that >> it's called before the drm_bridge is registered. > > Hans has since reworked the patch w/ a new version. You might want to > check his patches and see if they fit what your imagining. Yes, I saw Hans's patch after I wrote to you. That patch looks perfect. I'll queue that to the drm-misc repo once it's rebased on 4.15-rc1. Thanks, Archit > > thanks > -john > -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project