From patchwork Sun Oct 2 06:45:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2414 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 021443F331 for ; Sun, 2 Oct 2022 08:45:49 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id h11-20020a05640250cb00b004580ee86ca8sf6498614edb.6 for ; Sat, 01 Oct 2022 23:45:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664693148; cv=pass; d=google.com; s=arc-20160816; b=P0Ch/OF1tEAmaD8ges6qaP2QKG2Bz5AiSgmF5M7RATm3E8ConrUKVAcccH9FZb04tM QSozXFWF66iTlt16fqrPPulzsowAsF7nO90BdsFqCOUP9d9ThErg13K3vlyvt37v4v0m c+Hpn2MA0uiVZrZt3SwIeVhVyjbIB98X0/Gkz1C7x2JkBbcQOood6fMn9U+CdId0zT9+ mM6yF7TtLEZxv/smxk11s3Y4MYrpdwapULsy8hVSH3pfWF1Yn6Qt0pkt6jPn9IT1q3Jo f/MtIDZ3w4Xcm97mo8s965iJV2X3U+QwHYZnwTMZrNmgnndu7EeH78GFO33wskGBjn4j K+gA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=L918xq5l0e9jk4pn3xAJkMNJBkit0KUb1jSXi2POoqU=; b=dr+ddBgylraeohTsvTQUMG6YBixIkzDADMjsDVeKRLy/UEFPxkZctfnIesbiTsCdab KwUsh4edM1s6zJhBJxKLWGXfPLehI3959aErmHTJCnOLHvyPKxXX1tPPIFuqImBfvaid vS25GoZlFB+u/z9ve5srB/wlzJVmi0arhljgJ/kTbD9CcbmJflKLDg4XlLmsuEWBwlZr VaapqS3tBXkU0jFareAvab834g6ruJrL3JqzzDLa9suE6eq9ZdXdrnLon5ghkb4vkMHj bYCPLjVPj5mfV7hLG6ljAxXT2cJpllVmg9hXbcCDUmtN0wLhYfKy0p5kF1Awt1e+LakS kDrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kdPlUwAL; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date; bh=L918xq5l0e9jk4pn3xAJkMNJBkit0KUb1jSXi2POoqU=; b=h/oyohvS4cHxg4cYQphyEpv5WFJh+3v2glO+obPgeNtvu3yxSAIE/uWgGmhbxlGYEM 7zaf/UHeiy928QYtFYMSuhKkSYjlymhwlQ24m1l1/E2wFrg8QiV7Mggnha/zevQCnFup 5078mgudVrZ1suC2uvcnyPQmdcruCzcMRMRqg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date; bh=L918xq5l0e9jk4pn3xAJkMNJBkit0KUb1jSXi2POoqU=; b=cJmc9EPj/vbCvRoRFjE4OnApAks/mSEGL4wGN96DB4jgaGsu+cblJssbsJ0YJgzwIP 0Hk/jgnfg2HA6eg7uCK/NfVhgapcm+jPl7AoFII7xzfGpuCyE/FdNi8WxS/8+lr95RQq uSF99IdYpH5FB7woZlRqEM/g4LB58jGb5nBTrGvwdpodP2bc2Ltu+rSJbEPdlRrscQp1 efJ2C0Q7LgbOm+NI1cbvTy3/cuvWSBveq3DWBE2kXGYUkmc3siGyBfOEeoKC0kDF8r4u oob1YpoHW1AZlmHSOf8yUl5cXY3SR/vP7iTVzVeqXqg68TsTiK43TCHeqFElH0Q9uWxZ NfEg== X-Gm-Message-State: ACrzQf2UIzpmxwh+Zgcb4GKfGvZbjCg6ZKETx0whzk+Fl2it200VKbRE DACPnObsxvVLRlY5GWPyJj4wrhud X-Google-Smtp-Source: AMsMyM7APQcUOSNzdBZgJdQHUT1+zE+VcDV6QOKTZIlvbwqHu8R3G1uskDCAXCDEj2WQ3LKUdpAF6A== X-Received: by 2002:a05:6402:11d4:b0:452:a97c:cd36 with SMTP id j20-20020a05640211d400b00452a97ccd36mr13988645edw.53.1664693148694; Sat, 01 Oct 2022 23:45:48 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:42d0:b0:457:99eb:cba9 with SMTP id i16-20020a05640242d000b0045799ebcba9ls7951733edc.0.-pod-prod-gmail; Sat, 01 Oct 2022 23:45:47 -0700 (PDT) X-Received: by 2002:a05:6402:74a:b0:458:cfe2:f351 with SMTP id p10-20020a056402074a00b00458cfe2f351mr2954131edy.359.1664693147306; Sat, 01 Oct 2022 23:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664693147; cv=none; d=google.com; s=arc-20160816; b=fAG7RBNertg3JHe8fAM4T4Fe9h4Eb4RuQyrCd4n2BIqXyHT2TZdebB5qukWzedoh14 TxKsQeXlpBcMt1DLmWbOwCuhEHU1ehT4P4HEsAqH5hMde05U6ovMjfgahOdOo8btvIbo Z9z7TorzWWvG8R90lL/m8rNYL5o6ZnE4eQUslftDNaP71PcWGV1ak9978p5PdTdcVLDL bT47cdJW2dIG6RakfjpQTTnYq5vbYsYOnOB9mYiorQr5cQS+Kq9qU7udod572K3K42MT wUqVgrr79Fj137nCdYtjertER/+Nc3cVebBtNXGkyBUKuwf6ZkZJaZbVbsLQn4aj/0Ce Odfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=I6XMIDzmAb5OEYRQrNrBJ64J1RkMPb1xdg1o6LLrqS4=; b=cPCpEQVmtSCIK8//4R/oM3sWUjTprKEKUoF45c80zlrHQ1rte0KwyJVNFegVeNbLIo raqsGzZ5PTujvxhmAhjB/IASFYg+soShqUPah4s9aXcpuD5a9vtbi0TQvs0CHBCbaQ40 VgfjXfvw8Y5+jtupXxGLTP4uFcSh4L8U3RDZPsuEFCTJK582CNxjCeaxJsTXPED7J9A4 ZmXR1pM0EK2TYtK+S1pTDcMsT/u04UE9WjKDjs222xCRl8O9sG5C8WCG4fPBkIzz/CYA FUMZRLjwzJEryvboDeB5ZPNG8O/qvRH/4vaXc0/LEEznVwZm3u8iJd8WktbJWiPnODo/ yCTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kdPlUwAL; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id b13-20020a1709065e4d00b0077d1233d59csor2183126eju.49.2022.10.01.23.45.47 for (Google Transport Security); Sat, 01 Oct 2022 23:45:47 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:2c67:b0:77d:740a:e9b1 with SMTP id ib7-20020a1709072c6700b0077d740ae9b1mr11198850ejc.614.1664693146999; Sat, 01 Oct 2022 23:45:46 -0700 (PDT) Received: from panicking.. ([109.52.206.103]) by smtp.gmail.com with ESMTPSA id 26-20020a170906329a00b0077f5e96129fsm3569894ejw.158.2022.10.01.23.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 23:45:46 -0700 (PDT) From: Michael Trimarchi To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , David Airlie , Daniel Vetter Cc: Kishon Vijay Abraham I , Vinod Koul , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-amarula@amarulasolutions.com Subject: [RFC PATCH 2/4] phy: rockchip: Add inno_is_valid_phy_mode Date: Sun, 2 Oct 2022 08:45:38 +0200 Message-Id: <20221002064540.2500257-3-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com> References: <20221002064540.2500257-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kdPlUwAL; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The function is used to avoid to enable clock on the hardware if the mode requested is invalid Signed-off-by: Michael Trimarchi --- .../phy/rockchip/phy-rockchip-inno-dsidphy.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c index 630e01b5c19b..644cf73cfd53 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c @@ -217,6 +217,20 @@ static void phy_update_bits(struct inno_dsidphy *inno, writel(tmp, inno->phy_base + reg); } +static int inno_is_valid_phy_mode(struct inno_dsidphy *inno) +{ + switch (inno->mode) { + case PHY_MODE_MIPI_DPHY: + break; + case PHY_MODE_LVDS: + break; + default: + return -EINVAL; + } + + return 0; +}; + static unsigned long inno_dsidphy_pll_calc_rate(struct inno_dsidphy *inno, unsigned long rate) { @@ -495,6 +509,11 @@ static void inno_dsidphy_lvds_mode_enable(struct inno_dsidphy *inno) static int inno_dsidphy_power_on(struct phy *phy) { struct inno_dsidphy *inno = phy_get_drvdata(phy); + int ret = 0; + + ret = inno_is_valid_phy_mode(inno); + if (ret) + return ret; clk_prepare_enable(inno->pclk_phy); clk_prepare_enable(inno->ref_clk);