Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4546349imw; Tue, 19 Jul 2022 08:34:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vHjmCz1Ll0wUR/QRLZsHKH1fJd700t0wHq5Gwov4Osq7NJn2KhTg/TbtF58nLt80fIK/Fr X-Received: by 2002:a05:6402:1767:b0:43b:a844:14f with SMTP id da7-20020a056402176700b0043ba844014fmr500588edb.131.1658244866967; Tue, 19 Jul 2022 08:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658244866; cv=none; d=google.com; s=arc-20160816; b=uk55qmC648Nr0ojdRh/LVx/y298tXuusUAqXhRnDNYqD8Ar5QwBJWBjvxRy/6kDtFn wzQ0CRpStvn4k6idM0s0ug9dB2gn3kTivzCv7b2VbZ79vALpr5ToNhWRhoGsKoViIuia WYv3eK2hnUHFZyh9TgeeA8MDNBp6kQZgimwS4D2h5nAtd9TEsWkR5BZNCK3Hs47+91OE Ak8h5U5/tuSGH2xFQEYKqkQ2vqkcs6ekVRwd69YxdsX4u6bK1MDdvmTLSLE2Quwqyfsj nXLfxqtovAh8jBGgepIvT9itbl7zKZhz07EbxN9gnxKWLOj8ntY+V+nIKBgE7MTshr39 PTTQ== 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=pY2CMxbe7mYFu8lMmKdq8QyweRoqymfe+8LQesF8uYE=; b=im1JlPVVKAMSt4MJlZhSseEpXU3UpjD0HiJtBwjbOeBVgK/jHP6B0mBTRgLideovHx rG4WbDbHUBWI7i8VcBuEE/tw00nO7rwLS5Oy3jsufmN6PPrLTuIeFCD2UMh8tsIxnjSd v1Kwh15RK2r5FbdeHWuBmhEjmsPR9AujGpwgud9iqPM0++gvKa8j/XRV6EJZCqB7kKnU SbFhxYejrHdmmRvUPUCpM57ALOxOf36CeP6GZhM/Stq8D1BOFVAWtE57zTKB1k5gcgDd BKUbJbv+OJxXN4eB1c81fgk/FfgC4oEGDsbSJVYo1kceC+679RMpIzgjmKy7G9Z3+9V7 nDvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fECi+8lG; 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 g4-20020a1709067c4400b00726c8adb7efsi16588900ejp.224.2022.07.19.08.34.01; Tue, 19 Jul 2022 08:34:26 -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=fECi+8lG; 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 S237189AbiGSP0u (ORCPT + 99 others); Tue, 19 Jul 2022 11:26:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238232AbiGSP0o (ORCPT ); Tue, 19 Jul 2022 11:26:44 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E2A5564E0 for ; Tue, 19 Jul 2022 08:26:43 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id os14so27882399ejb.4 for ; Tue, 19 Jul 2022 08:26:43 -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=pY2CMxbe7mYFu8lMmKdq8QyweRoqymfe+8LQesF8uYE=; b=fECi+8lG3d2QZQyelZpEsteMq5/Ly7PqyvAXApZORRN6U6VHI/Xd+RT65kVSQlhDfs RIifDvE6urMrudmyO/TXET1KzXJlRNUevdgDbV4Gy8PkxHRcCI9979O3Pwkm1ooW1IZl 9k/2wyz4Y8r9wO9qqWZu5nBeC6mOWJ7ljwgzEKOPo3COpIzVJCP0oPj3c9atpX7OPNZW B14tRFln6rYqvb17WBktV6HEXlgQX97UT3VJNDoFJE2QmKONgjh22rmFbr9Ou2oQNlUf Q4trtaDSh5fGHLmUMI5/YAHF+CaUk6pM8Ghcb3JO/WsEeYAI131CpfPk9hn8m/fwMvfL lesQ== 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=pY2CMxbe7mYFu8lMmKdq8QyweRoqymfe+8LQesF8uYE=; b=iRf3c8lQCfME/vfUoemtvGPb5J8frLq0CTA7Y2flAB67CUc4YhPoZHgy4iM2pXTvB7 LfUaB2UAc3+GYsb0S53kDAJLPT6axaIhUpj1cF1Wnrr9L6gA3M0I13lOoODvHNE05YUF NS/ML0RowGmKrxhh/8+iNZ8t35w7T/gHXCKpZQVJjAVrT9tKLxmuy/GdYoE8VayBIIIy g2QODjKpPJ7GbZijw3drDHsVsnB21K6HIxSfhE0DVA/ZgDq/5qqtGUIDyduRBJejzA/0 d5r4RRArFTpVsSSvsetp7djYrlu2EVhwCd6dG4rsrZcGPQ8RYYswtnXgozAT2nxeQnda Uhyg== X-Gm-Message-State: AJIora8OSLVaTJl8EIRNENSz/dRROEhnpV/GTa8G37+9uvgO7przOLzs yv9huwoA1wdxnu8JNvb0cGypinGb26hGMyetwnBH/A== X-Received: by 2002:a17:907:7f9e:b0:72e:d375:431 with SMTP id qk30-20020a1709077f9e00b0072ed3750431mr27276672ejc.580.1658244401767; Tue, 19 Jul 2022 08:26:41 -0700 (PDT) MIME-Version: 1.0 References: <20220713031547.11641-1-allen.chen@ite.com.tw> In-Reply-To: <20220713031547.11641-1-allen.chen@ite.com.tw> From: Robert Foss Date: Tue, 19 Jul 2022 17:26:30 +0200 Message-ID: Subject: Re: [PATCH v2] drm/bridge: it6505: Add i2c api power on check To: allen Cc: Jau-Chih Tseng , Kenneth Hung , Hermes Wu , Pin-yen Lin , 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 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 Wed, 13 Jul 2022 at 05:16, allen wrote: > > From: allen chen > > Use i2c bus to read/write when it6505 power off will occur i2c error. > Add this check will prevent i2c error when it6505 power off. > > Signed-off-by: Pin-Yen Lin > Signed-off-by: Allen Chen > Reviewed-by: Robert Foss > --- > 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 > This patch no longer applies to the drm-misc-next tree, could you rebase it and send out a v3?