Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4105439imw; Tue, 12 Jul 2022 01:45:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sfLZa0p5hhHDrt+xTW4UfsDetSa0nLAhE+7sIVGuPMOryuMwzmOIKKV4l4aJYBqCx/ZWZJ X-Received: by 2002:a05:6402:2395:b0:43a:6d91:106c with SMTP id j21-20020a056402239500b0043a6d91106cmr30893776eda.299.1657615550483; Tue, 12 Jul 2022 01:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657615550; cv=none; d=google.com; s=arc-20160816; b=PzhvCy3pVRT8YeMuhwGU61RNikT+bUF3x1I+T+6DmaRUwxsJsqIlHTKGzRhnE90XMo 4Irb8UiMi9ZECIVT4rIJ/qf6/KqEsIbT63eg6yuNJsn3sev2/+y8tVxASKJSZjVJHAvk gZHB19R9pU/bSmSgWanwsXKYSUP9BLj4oiXbLXr8jOhkrli2nXNhzrUTVW18DVd9Cmz5 ohhfQSkziM/iWrJR3IR0WnYnNgyijK6vCDQjPEtR4cD6aHcuJFg23knYKfS3e+kf3KfV hp6K2mSmaNi68ANXByHkf1IOGTOCeYZiIL+5t/Qr1/F5VTzL1b7mUe3bHoje+5C1sn3l bsuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BAblE0VfQqsX2FhEhlmNF0MI2SNQOD6qrUOnSLVyV4g=; b=MfyNugloQN0MeWoc4vIvELUbnJWa1GnjVkcgwpPxgFBuTdjIxohSS26NWKvgqBWzQR 4DkFMSPltHEETf9zqnSh5mL+9YHKVfQC1nUD4YbUAFX28W+RJELvuhLNKeSdFZOwfZOW U8HMeJ4VQazoX0U2S5BRrJ9nxUoixxjbdvvr9it9N4vnNwzbyg0gQeuGs4qlBZVonu8d TDJTYg6SFGO17xBX6ftm8+wcB5W5Oz4z4Zh47r4v0g2LbiIjR0rNcPzZnw5bu9HSMpmx qr3tazJHYARC88771DqwEwQlrwiJ7eLYHh3ZTNSv9wrW6xxd5OvBEL2FUvyccBQchxLP FDeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ivBDfg89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd7-20020a1709076e0700b00718cc1814aasi13169422ejc.845.2022.07.12.01.45.25; Tue, 12 Jul 2022 01:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ivBDfg89; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232155AbiGLILd (ORCPT + 99 others); Tue, 12 Jul 2022 04:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbiGLILa (ORCPT ); Tue, 12 Jul 2022 04:11:30 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4984733E2C for ; Tue, 12 Jul 2022 01:11:29 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id b11so12899919eju.10 for ; Tue, 12 Jul 2022 01:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BAblE0VfQqsX2FhEhlmNF0MI2SNQOD6qrUOnSLVyV4g=; b=ivBDfg89ttyBXF2y7cPm4jaQbb5003PCxWgf/aXnVIOQ9lzVlgUx8hxJcF0Y2lofFb IoYC1WixKj5jb1Qtb5pnd5zf5XWP8aX8nB0+EeB8+a3Em//uQzGCekpcVs1xfW6bIspz LbuOl2j+9jaUiWi/OLV1vPeyr7bpMr7ddoEiXMjOQi93z872tZSI+oqqd4xW+Ni/9aMj wDM3OZJel9JhH32s2ZyzmLkBH/hq0oCXYiGi0ZvfOXsMUOy7TNssIHWM0E6oPYr4BOmP v6q49mCdkkhPd22DO+bkd6S5JHJ2hVqf2rT7ALMj4Qsn6V3ATUhsTs05bwWkW2peG7s6 +CIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BAblE0VfQqsX2FhEhlmNF0MI2SNQOD6qrUOnSLVyV4g=; b=B/rc0v8B0fP9GJUk5wDuTfTxF8NaaPY0mOYO+kevAotZjAgqFf/KBJ7S2ji4tWsRT7 PUQqk6ZC5JkRgnbY2I4yTj3T+y5h/iTu+Ww/GqmLTQgkJTI7f0GF1YO+ONiyAjHC8OzX sH8L+rRTyDg6+65O3BocDAuej4lOwtZQ83j9SAlek8VE+TXIoMc1vdFT/b5Eu1JznGqq vpqwaUo4Hgy0JmuA1O/xVwUyWssER9dyRHTtnEWGpyUMn9PoqwEeJCt4mPYfaJcD7tPr UO2hkRjmeCErtt/EbUGFqQ+3y+Ya0zBdGH4NaJMikJC4wfymQG2jSeVYPSbnQ0FyQKww V44w== X-Gm-Message-State: AJIora+THI5YjEppfIcqBg7gZ3lScYl+1qHjjqJcx3dAHf80w7h+0l9M 7dfrw4WgrrcITTBfKf2TSwA/d5lbiwoekhPkBekrqg== X-Received: by 2002:a17:907:7b87:b0:726:c868:cf38 with SMTP id ne7-20020a1709077b8700b00726c868cf38mr22365650ejc.580.1657613487777; Tue, 12 Jul 2022 01:11:27 -0700 (PDT) MIME-Version: 1.0 References: <20220707080600.49041-1-allen.chen@ite.com.tw> <20220707080600.49041-3-allen.chen@ite.com.tw> In-Reply-To: <20220707080600.49041-3-allen.chen@ite.com.tw> From: Robert Foss Date: Tue, 12 Jul 2022 10:11:16 +0200 Message-ID: Subject: Re: [PATCH 2/3] drm/bridge: it6505: Add i2c api power on check To: allen Cc: Pin-yen Lin , Jau-Chih Tseng , Kenneth Hung , Hermes Wu , Pin-Yen Lin , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , "open list:DRM DRIVERS" , open list Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Jul 2022 at 10:06, allen wrote: > > From: allen chen > > Use i2c bus to read/write when it6505 power off will occure i2c error. ^^^ typ-o Change occure to occur. This is an issue that would have been caught by running checkpatch --strict, please try to run it on all patches before submission. > Add this check will prevent i2c error when it6505 power off. > > Signed-off-by: Pin-Yen Lin > Signed-off-by: Allen Chen > > --- > drivers/gpu/drm/bridge/ite-it6505.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c > index aa5e0aa1af85..cfd2c3275dc5 100644 > --- a/drivers/gpu/drm/bridge/ite-it6505.c > +++ b/drivers/gpu/drm/bridge/ite-it6505.c > @@ -518,6 +518,9 @@ static int it6505_read(struct it6505 *it6505, unsigned int reg_addr) > int err; > struct device *dev = &it6505->client->dev; > > + if (!it6505->powered) > + return -ENODEV; > + > err = regmap_read(it6505->regmap, reg_addr, &value); > if (err < 0) { > dev_err(dev, "read failed reg[0x%x] err: %d", reg_addr, err); > @@ -533,6 +536,9 @@ static int it6505_write(struct it6505 *it6505, unsigned int reg_addr, > int err; > struct device *dev = &it6505->client->dev; > > + if (!it6505->powered) > + return -ENODEV; > + > err = regmap_write(it6505->regmap, reg_addr, reg_val); > > if (err < 0) { > @@ -550,6 +556,9 @@ static int it6505_set_bits(struct it6505 *it6505, unsigned int reg, > int err; > struct device *dev = &it6505->client->dev; > > + if (!it6505->powered) > + return -ENODEV; > + > err = regmap_update_bits(it6505->regmap, reg, mask, value); > if (err < 0) { > dev_err(dev, "write reg[0x%x] = 0x%x mask = 0x%x failed err %d", > @@ -2553,13 +2562,12 @@ static int it6505_poweron(struct it6505 *it6505) > usleep_range(10000, 20000); > } > > + it6505->powered = true; > it6505_reset_logic(it6505); > it6505_int_mask_enable(it6505); > it6505_init(it6505); > it6505_lane_off(it6505); > > - it6505->powered = true; > - > return 0; > } > > -- > 2.25.1 > With that fixed: Reviewed-by: Robert Foss