From patchwork Tue Nov 14 15:01:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13455490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 890CDC4167D for ; Tue, 14 Nov 2023 15:09:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 40AE510E430; Tue, 14 Nov 2023 15:09:42 +0000 (UTC) X-Greylist: delayed 453 seconds by postgrey-1.36 at gabe; Tue, 14 Nov 2023 15:09:32 UTC Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39ED310E21E for ; Tue, 14 Nov 2023 15:09:32 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1699974142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tk2pBXgQD0Hn7zpS98T/yj1apxuqc9nh5y9T0ytNhnY=; b=IG+qX9fhNU13FWEzeAZz9CPbGXv4Uly+pxQorlItWtMm/A+Gg8MLaKRo/b7sILbTskuT8o 4kIPnkiw7jtyV9we+sG8iA5WJrI4dONftKCvJ5peYK7Z5SVLke//m+V7D1J4WernaPkb2k vMg9KunawNFPE+bT756aiR/b3oyM738= From: Sui Jingfeng To: Phong LE , Neil Armstrong Subject: [PATCH 6/8] drm/bridge: it66121: Add a helper to initialize the DRM bridge structure Date: Tue, 14 Nov 2023 23:01:28 +0800 Message-Id: <20231114150130.497915-7-sui.jingfeng@linux.dev> In-Reply-To: <20231114150130.497915-1-sui.jingfeng@linux.dev> References: <20231114150130.497915-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maxime Ripard , Sui Jingfeng , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart , Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sui Jingfeng Helps the it66121_probe() function to reduce weight, no functional change. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/ite-it66121.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index f36d05331f25..2f7f00f1bedb 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1004,6 +1004,21 @@ static const struct drm_bridge_funcs it66121_bridge_funcs = { .hpd_disable = it66121_bridge_hpd_disable, }; +static void it66121_bridge_init_base(struct drm_bridge *bridge, + struct device_node *of_node, + bool hpd_support) +{ + bridge->funcs = &it66121_bridge_funcs; + bridge->type = DRM_MODE_CONNECTOR_HDMIA; + bridge->ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; + if (hpd_support) + bridge->ops |= DRM_BRIDGE_OP_HPD; + + bridge->of_node = of_node; + + drm_bridge_add(bridge); +} + static irqreturn_t it66121_irq_threaded_handler(int irq, void *dev_id) { int ret; @@ -1637,11 +1652,6 @@ static int it66121_probe(struct i2c_client *client) ctx->device_id != ctx->info->pid) return -ENODEV; - ctx->bridge.funcs = &it66121_bridge_funcs; - ctx->bridge.of_node = dev->of_node; - ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA; - ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD; - ret = devm_request_threaded_irq(dev, client->irq, NULL, it66121_irq_threaded_handler, IRQF_ONESHOT, dev_name(dev), ctx); if (ret < 0) { @@ -1649,9 +1659,9 @@ static int it66121_probe(struct i2c_client *client) return ret; } - it66121_audio_codec_init(ctx, dev); + it66121_bridge_init_base(&ctx->bridge, dev->of_node, true); - drm_bridge_add(&ctx->bridge); + it66121_audio_codec_init(ctx, dev); dev_info(dev, "IT66121 probed, chip id: 0x%x:0x%x, revision: %u\n", ctx->vender_id, ctx->device_id, ctx->revision);