From patchwork Thu Apr 13 09:07:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 9679207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9229C60326 for ; Thu, 13 Apr 2017 11:18:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85B782861F for ; Thu, 13 Apr 2017 11:18:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AAD528639; Thu, 13 Apr 2017 11:18:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 174D62861F for ; Thu, 13 Apr 2017 11:18:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF1A66E886; Thu, 13 Apr 2017 11:17:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 658DD6E83D; Thu, 13 Apr 2017 09:07:13 +0000 (UTC) Received: by mail-wr0-x22f.google.com with SMTP id c55so31630999wrc.3; Thu, 13 Apr 2017 02:07:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=ubbV3mrlZ4Rga8ZoDIfpZJd9T4bfcfqfTYjqAotGgd8=; b=ZJu2QbZFR8ieeeNpuEYfVcoC19nNhsXLPMpjecB8eaWksEGNkZx7eu5dg6cEEZ6aRJ 9fjj+PeFoiRoXLG73Dsh2k/XN1baEASoraWbEwso8RGkU7m6M4D3vcDSz6e5JwYzsnXE Ee65WTPKW6/XKotj8aLXDrFx5VTH/f5YtVCKZcb3Fwsq33lWWhutvNRVvKUealuBKh62 u0ByT7i8JTr8tih9Mv/Lf4dhHAaCy/MAaLexutVunAeefbx0IU/EaVsHFgETagRAd7GA 73WTXStZCT0KwScjUx+wj5Quzojwj/d+BqxCCHSvYgM43dz5dN96avpb+SDqdb6HKFQE RUWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=ubbV3mrlZ4Rga8ZoDIfpZJd9T4bfcfqfTYjqAotGgd8=; b=I9uC61Pjl6Icf01dl/FPE+wMAzHpzPFe08nCNQpA72mL7aX4TbetFh4i28WcGVPKID ayUnF+zwEuvGLR5/bRLHOSTA9afpnR5XfBn9WiUMCIq7bRebh4I8Rdvk6rND9+uvhAbt gDTqi0BsVFDHPrsVK1vRdPsGu4Y2MafAgYCHBoYCNoLOaApE/J3zEvYMzAO7JmcH/ToC 1RBwbOQ3a09Dy3+8b0KNIBr1MV4OPbfImdnQs8CIx7qT2lJY6e9FcofmR7+04i1Dt1Cc gg36hqRo/PsBODYCntLznpAN3i+LE0yRbaO+WMBjx9k9GLA5q7LXhJ1JWYkOcudLYGMV GRaw== X-Gm-Message-State: AN3rC/45nZc3hwVyfiS4NlzuJr3ZRx0zprjSOUZjds+TWp/ggJdEEfzv 0cqI8lsOOZZchRa7 X-Received: by 10.223.139.215 with SMTP id w23mr1868510wra.169.1492074431881; Thu, 13 Apr 2017 02:07:11 -0700 (PDT) Received: from linux-3pot ([2001:868:0:200:56be:f7ff:fe88:b800]) by smtp.gmail.com with ESMTPSA id k63sm9723024wmf.9.2017.04.13.02.07.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Apr 2017 02:07:11 -0700 (PDT) Date: Thu, 13 Apr 2017 11:07:06 +0200 From: Oscar Salvador To: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH 0/4] nouveau_hwmon: migrate to hwmon_device_register_with_info Message-ID: <20170413090706.qlmph5y4g5iac45l@linux-3pot> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.2 (2016-07-01) X-Mailman-Approved-At: Thu, 13 Apr 2017 11:17:04 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi again, I've split the patches as Karol Herbst suggested. I hope now it's fine. This series of patches introduce the new hwmon_device_register_with_info and gets rid of the old hwmon_device_register. This patch adds the default sensors with their possible config values. Just to prepare for the next patches --- linux/drivers/gpu/drm/nouveau/nouveau_hwmon.c.orig 2017-04-12 19:18:09.638073562 +0200 +++ linux/drivers/gpu/drm/nouveau/nouveau_hwmon.c 2017-04-12 19:19:44.244797202 +0200 @@ -692,6 +692,78 @@ static const struct attribute_group hwmo static const struct attribute_group hwmon_power_caps_attrgroup = { .attrs = hwmon_power_caps_attributes, }; + +static const u32 nouveau_config_chip[] = { + HWMON_C_UPDATE_INTERVAL, + 0 +}; + +static const u32 nouveau_config_in[] = { + HWMON_I_INPUT | HWMON_I_MIN | HWMON_I_MAX | HWMON_I_LABEL, + 0 +}; + +static const u32 nouveau_config_temp[] = { + HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MAX_HYST | + HWMON_T_CRIT | HWMON_T_CRIT_HYST | HWMON_T_EMERGENCY | + HWMON_T_EMERGENCY_HYST, + 0 +}; + +static const u32 nouveau_config_fan[] = { + HWMON_F_INPUT, + 0 +}; + +static const u32 nouveau_config_pwm[] = { + HWMON_PWM_INPUT | HWMON_PWM_ENABLE, + 0 +}; + +static const u32 nouveau_config_power[] = { + HWMON_P_INPUT | HWMON_P_CAP_MAX | HWMON_P_CRIT, + 0 +}; + +static const struct hwmon_channel_info nouveau_chip = { + .type = hwmon_chip, + .config = nouveau_config_chip, +}; + +static const struct hwmon_channel_info nouveau_temp = { + .type = hwmon_temp, + .config = nouveau_config_temp, +}; + +static const struct hwmon_channel_info nouveau_fan = { + .type = hwmon_fan, + .config = nouveau_config_fan, +}; + +static const struct hwmon_channel_info nouveau_in = { + .type = hwmon_in, + .config = nouveau_config_in, +}; + +static const struct hwmon_channel_info nouveau_pwm = { + .type = hwmon_pwm, + .config = nouveau_config_pwm, +}; + +static const struct hwmon_channel_info nouveau_power = { + .type = hwmon_power, + .config = nouveau_config_power, +}; + +static const struct hwmon_channel_info *nouveau_info[] = { + &nouveau_chip, + &nouveau_temp, + &nouveau_fan, + &nouveau_in, + &nouveau_pwm, + &nouveau_power, + NULL +}; #endif int