From nobody Tue Feb 10 12:43:12 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1593354613; cv=none; d=zohomail.com; s=zohoarc; b=jyHT3IqkvzD4U1fYRwx3PTEMmYblMIt8lGq3uvIC5IX2VteJ884obzBPf7gBeSqtDGQTpZ35MnwJcZTZyGmMsGivO8h4V4u6EWwLDIpyCK/1SWZe6OIbgj933SqImsrsQuZ/obuMNA57ejglc4WvvH8pJwO4a8mp9sHrsQ0EnYY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593354613; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uwJ6AMnZ4BeCXoBcjEvXgzYDqM09D0Grg4qI2GYORlA=; b=mcd5hjl+O1vlTCtARYbH0a2p6RH1UzzX6CJnlZHN7iVyw1GdSC4MLSe5ldhjpUHAOaZTRpacuGjStJ1ZOzZkSkoiZ0PgKRw9WpH1GK0JjNOZ9/P41zaZ4mIBPLFy+troJcjbnP3a926r4wScG4VeK+rhTTy8rhNNcYOIvmVDqSs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593354613596946.5832970106759; Sun, 28 Jun 2020 07:30:13 -0700 (PDT) Received: from localhost ([::1]:37208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpYJw-00071P-At for importer@patchew.org; Sun, 28 Jun 2020 10:30:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpYEe-0006As-Mf for qemu-devel@nongnu.org; Sun, 28 Jun 2020 10:24:44 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54851) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpYEZ-0004gr-El for qemu-devel@nongnu.org; Sun, 28 Jun 2020 10:24:44 -0400 Received: by mail-wm1-x342.google.com with SMTP id o8so13000314wmh.4 for ; Sun, 28 Jun 2020 07:24:39 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h13sm5321555wml.42.2020.06.28.07.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 07:24:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uwJ6AMnZ4BeCXoBcjEvXgzYDqM09D0Grg4qI2GYORlA=; b=w9idSx+0gR7I3+whwLAtTQ7A4m1JDKYQnxwFpVGWoy1zyPJoHtWn7jrBfB64yYDhJb zRX3DoCDbWX/lt3udEUqF/quULhT1YkeaRLgjM+re95BUz4X0n7bBmmscdehIdfz6EfS ZENQM4oFGmfjl562zDe214qYQExwzKV3gUG/M6Ru+EDf5hMMzembzNkRl7vz83SEW/Af iosd6MKXYzjZ/P/W9/Zabs4dZ9DFC7XGhtl7QVWW11N7jyAMQ6htRfvzY49/Wdh7rTpL sUrg2OS2etoBz/9Om/tvB8TgUj6UehkxeKe2gWQmls6zORlGtCbARZgunh23/GcEiiDe exbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uwJ6AMnZ4BeCXoBcjEvXgzYDqM09D0Grg4qI2GYORlA=; b=DN2DZwAFSp8e81lLRq9WfGBJx+DX9TT9rAVJiHUirg6uZW3hAopO8JqZUI8idRmVIP k9JxF96RCXPxObIt+2ZFTbK9j8Imv8KehPf2ripme6ayr8kMZzHdO9JVcQw7JmoXZspL w4iKoSWnhxGLBb4Qh9corUeRyjda78AmFA99O6ROluAAXLJG+WQbvKAPPQ0s8Gv9ivLu A8Weeex/voMkf9nQUuvBZSLjGg1GA9AodYxWlxOMIla4bl19lV8P669ZAbPWZ5clLXWt 9Vi+kIUroKIFZiv2hblPZwWp1wFtwUOODW4ElA7MzlfDah9VtdpTdaL0GCRaLiPONLpj KXZg== X-Gm-Message-State: AOAM530M2xwtoPB/iSp3xHz9aV+t4HnRNp09XzmNKzs4TpH7ZI2IzBQo P/A+656vmAkRkmxo5NYVAtGMUA== X-Google-Smtp-Source: ABdhPJzNybbq/Q5THx6AN2Pq4mbtM4WBGacxWUfLq08e7SVuU3AzC9cJUE3PCLIswe1KLCqccZ3VwQ== X-Received: by 2002:a1c:9650:: with SMTP id y77mr8861480wmd.101.1593354278097; Sun, 28 Jun 2020 07:24:38 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 05/17] hw/arm/spitz: Implement inbound GPIO lines for bit5 and power signals Date: Sun, 28 Jun 2020 15:24:17 +0100 Message-Id: <20200628142429.17111-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200628142429.17111-1-peter.maydell@linaro.org> References: <20200628142429.17111-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Currently the Spitz board uses a nasty hack for the GPIO lines that pass "bit5" and "power" information to the LCD controller: the lcdtg realize function sets a global variable to point to the instance it just realized, and then the functions spitz_bl_power() and spitz_bl_bit5() use that to find the device they are changing the internal state of. There is a comment reading: FIXME: Implement GPIO properly and remove this hack. which was added in 2009. Implement GPIO properly and remove this hack. Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis --- hw/arm/spitz.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 69bc2b3fa10..11e413723f4 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -586,12 +586,9 @@ static void spitz_bl_update(SpitzLCDTG *s) zaurus_printf("LCD Backlight now off\n"); } =20 -/* FIXME: Implement GPIO properly and remove this hack. */ -static SpitzLCDTG *spitz_lcdtg; - static inline void spitz_bl_bit5(void *opaque, int line, int level) { - SpitzLCDTG *s =3D spitz_lcdtg; + SpitzLCDTG *s =3D opaque; int prev =3D s->bl_intensity; =20 if (level) @@ -605,7 +602,7 @@ static inline void spitz_bl_bit5(void *opaque, int line= , int level) =20 static inline void spitz_bl_power(void *opaque, int line, int level) { - SpitzLCDTG *s =3D spitz_lcdtg; + SpitzLCDTG *s =3D opaque; s->bl_power =3D !!level; spitz_bl_update(s); } @@ -639,13 +636,16 @@ static uint32_t spitz_lcdtg_transfer(SSISlave *dev, u= int32_t value) return 0; } =20 -static void spitz_lcdtg_realize(SSISlave *dev, Error **errp) +static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) { - SpitzLCDTG *s =3D FROM_SSI_SLAVE(SpitzLCDTG, dev); + SpitzLCDTG *s =3D FROM_SSI_SLAVE(SpitzLCDTG, ssi); + DeviceState *dev =3D DEVICE(s); =20 - spitz_lcdtg =3D s; s->bl_power =3D 0; s->bl_intensity =3D 0x20; + + qdev_init_gpio_in_named(dev, spitz_bl_bit5, "bl_bit5", 1); + qdev_init_gpio_in_named(dev, spitz_bl_power, "bl_power", 1); } =20 /* SSP devices */ @@ -820,15 +820,11 @@ static void spitz_out_switch(void *opaque, int line, = int level) case 3: zaurus_printf("Orange LED %s.\n", level ? "on" : "off"); break; - case 4: - spitz_bl_bit5(opaque, line, level); - break; - case 5: - spitz_bl_power(opaque, line, level); - break; case 6: spitz_adc_temp_on(opaque, line, level); break; + default: + g_assert_not_reached(); } } =20 @@ -858,9 +854,9 @@ static void spitz_scoop_gpio_setup(SpitzMachineState *s= ms) =20 if (sms->scp1) { qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_CONT, - outsignals[4]); + qdev_get_gpio_in_named(sms->lcdtg, "bl_bit5"= , 0)); qdev_connect_gpio_out(sms->scp1, SPITZ_SCP2_BACKLIGHT_ON, - outsignals[5]); + qdev_get_gpio_in_named(sms->lcdtg, "bl_power= ", 0)); } =20 qdev_connect_gpio_out(sms->scp0, SPITZ_SCP_ADC_TEMP_ON, outsignals[6]); --=20 2.20.1