Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3802609rdg; Wed, 18 Oct 2023 06:37:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcHz2jYEw/Nm8tSK+bGavAEQNZdJ4dqXfStmbX0/vCR5z9tYtlzoXwJbPmXD3yYks8wdFQ X-Received: by 2002:a17:90b:3810:b0:27d:2054:9641 with SMTP id mq16-20020a17090b381000b0027d20549641mr5030575pjb.36.1697636246132; Wed, 18 Oct 2023 06:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697636246; cv=none; d=google.com; s=arc-20160816; b=jZCN7xiSLWggO9jeLYXsfIlhMGRWWKMioMXLZypITwhVwImlXzQG6k+omTkd6L+E/d cqIGCq/OKCy4oXiP5EPzggBtXCAbM/Bks8+khJhKRZonJmdurzflPW0KLVGeIPfIXFTn QFo67LIdu1uAt213XBvKrLkI4s4v++0TL7Imq4CyOZ4JkU1A8NsM28/iXG2DgfuQQv/S ur2sC42nRjwg4WvmTd8QqB4soeQ5NopDAxni3BczF7PXCrurttum9IQNky+MVELXEfDq EwAXM4gSeouan5hUz2d7mSUaVDcKWuv+8aRbFW6Cj4LhcP00bzWjoriwWBdarKKNFOtH cwxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=CFxEek66TmBnU4D7aOn3ltdI8hm4v3qdqYtDHMh4z5Q=; fh=LdIfQiJiWNnbEXk8WAy+FWbazWHYBwp/pi35o0HJmbM=; b=JF4scB+y6t5vaUgl0rHRNN0DiYW7NPbilb9Wl4MNozQdNabgQs7eP3UKEj+9oSC5Dr AKmgkD5KfWHCZhBhxVoN1jkJYUwWpS2jltt9pvhT3DDY6Sf0wDL4F7WzR4/OaCe+XGlV d/GmX+iH2KHSq4fzZIyaoYVE+ZAFUSeb+QgPuIvhqUfEUWyWXoIMS831oc5jHVP/PIou v0MXI+Ubxsg5b2yKDMXQURqRWRmT7RPdF3YhS5zN0n5bjJ4172ZGmi+cUFyiTPuZQznc J89JMFI3mAXzUN8dxEUtoP4OfDDMDkGvfOtkXkx+h5CJ1+KeXp95f8wdGpI4YAzkxSLx 6PmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HzMv5ne6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id oa16-20020a17090b1bd000b0027d559a84aasi1530003pjb.154.2023.10.18.06.37.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HzMv5ne6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A5C248024073; Wed, 18 Oct 2023 06:37:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbjJRNhF (ORCPT + 99 others); Wed, 18 Oct 2023 09:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbjJRNhE (ORCPT ); Wed, 18 Oct 2023 09:37:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2003DBA for ; Wed, 18 Oct 2023 06:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697636179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFxEek66TmBnU4D7aOn3ltdI8hm4v3qdqYtDHMh4z5Q=; b=HzMv5ne6HfGiPR+e7An71uLn/VYJiKMFMgFVXVh9U3Waa9ikQAuqPSea+TMpwiErQ07bCn OXMU78WUKyIm6T5KUT8oVLaeqE0P9kfMDFDFWIxk7SGcTsBYhF+3s2Wspw9P/nXdlWVHBZ dwlypq/lOjuZS0DEDBW37EbN8pVekrw= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-190-HLdxwL_ePUqJH38j08k-DA-1; Wed, 18 Oct 2023 09:36:06 -0400 X-MC-Unique: HLdxwL_ePUqJH38j08k-DA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-9bd7c682b33so518128366b.3 for ; Wed, 18 Oct 2023 06:36:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697636164; x=1698240964; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CFxEek66TmBnU4D7aOn3ltdI8hm4v3qdqYtDHMh4z5Q=; b=lvhExjlCzlivXTj1y0oId2SwWp6loaZs6nBHT7+ww+vzTCfr/bQgT99hZFC7c2UEOj OmnRpULZXPr/aCWFcZJIa7s0ZznX49NzRDyIfupRXWSHoZk5DAYe68F8zB4phRLTBeSL xwfnz0oa55JqOTWGqV4WyN+1H2XlzR25KjsORt2YuTh4nAzr3BM1Vh89zHphhJnKNhj+ MJ9atDBjkZHyn/0IkmXRHSa8d4XcHNZHh7dvjMkD78idoJFV8QPGD2jl73pXAQzg9T2K XMyi9Mp2mfSSqM3rAcKBdy2SlpTcXgYqFjzMcUF88403CeN9z9htEW0sbncZIple0VQx JAlg== X-Gm-Message-State: AOJu0Yx0uJAEJqMTE3ruPSsqKacf0Ym1dhRINejpJy6aGSY8NEsoJZ76 RYTC/jHEirldQW2CmFxDVZmMGSN//Sn/b0JznfHCORmAf7lOAF2NocZ6njAErX+xuSz0gImlflH 6ysIDbx490HBFjptqLWnFmFri+YivnGXj X-Received: by 2002:a17:906:6a1f:b0:9be:6410:b3c0 with SMTP id qw31-20020a1709066a1f00b009be6410b3c0mr4829382ejc.33.1697636164609; Wed, 18 Oct 2023 06:36:04 -0700 (PDT) X-Received: by 2002:a17:906:6a1f:b0:9be:6410:b3c0 with SMTP id qw31-20020a1709066a1f00b009be6410b3c0mr4829364ejc.33.1697636164277; Wed, 18 Oct 2023 06:36:04 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id j8-20020a1709064b4800b009a1a653770bsm1681253ejv.87.2023.10.18.06.36.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Oct 2023 06:36:03 -0700 (PDT) Message-ID: Date: Wed, 18 Oct 2023 15:36:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 1/1] apple-gmux: Hard Code max brightness for MMIO gmux Content-Language: en-US, nl To: Orlando Chamberlain Cc: Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Aditya Garg , Aun-Ali Zaidi , Kerem Karabay , Karsten Leipold References: <20231017111444.19304-2-orlandoch.dev@gmail.com> From: Hans de Goede In-Reply-To: <20231017111444.19304-2-orlandoch.dev@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 06:37:23 -0700 (PDT) Hi, On 10/17/23 13:14, Orlando Chamberlain wrote: > The data in the max brightness port for iMacs with MMIO gmux incorrectly > reports 0x03ff, but it should be 0xffff. As all other MMIO gmux models > have 0xffff, hard code this for all MMIO gmux's so they all have the > proper brightness range accessible. > > Reported-by: Karsten Leipold > Signed-off-by: Orlando Chamberlain Thank you for your patch/series, I've applied this patch (series) to the pdx86 fixes branch: https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=fixes I have added the following Fixes: tag while merging this: Fixes: 0c18184de990 ("platform/x86: apple-gmux: support MMIO gmux on T2 Macs") I will include this patch in my next fixes pull-req to Linus for the current kernel development cycle. Regards, Hans > --- > drivers/platform/x86/apple-gmux.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c > index cadbb557a108..1417e230edbd 100644 > --- a/drivers/platform/x86/apple-gmux.c > +++ b/drivers/platform/x86/apple-gmux.c > @@ -105,6 +105,8 @@ struct apple_gmux_config { > #define GMUX_BRIGHTNESS_MASK 0x00ffffff > #define GMUX_MAX_BRIGHTNESS GMUX_BRIGHTNESS_MASK > > +# define MMIO_GMUX_MAX_BRIGHTNESS 0xffff > + > static u8 gmux_pio_read8(struct apple_gmux_data *gmux_data, int port) > { > return inb(gmux_data->iostart + port); > @@ -857,7 +859,17 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id) > > memset(&props, 0, sizeof(props)); > props.type = BACKLIGHT_PLATFORM; > - props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS); > + > + /* > + * All MMIO gmux's have 0xffff as max brightness, but some iMacs incorrectly > + * report 0x03ff, despite the firmware being happy to set 0xffff as the brightness > + * at boot. Force 0xffff for all MMIO gmux's so they all have the correct brightness > + * range. > + */ > + if (type == APPLE_GMUX_TYPE_MMIO) > + props.max_brightness = MMIO_GMUX_MAX_BRIGHTNESS; > + else > + props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS); > > #if IS_REACHABLE(CONFIG_ACPI_VIDEO) > register_bdev = acpi_video_get_backlight_type() == acpi_backlight_apple_gmux;