All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: linux-hwmon@vger.kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 02/10] hwmon: (emc2305) Drop platform data support
Date: Tue, 10 Nov 2026 10:34:25 -0800	[thread overview]
Message-ID: <20261110183434.181711-3-linux@roeck-us.net> (raw)
In-Reply-To: <20261110183434.181711-1-linux@roeck-us.net>

There are no in-tree users of emc2305_platform_data. Active PWM channel
count is detected from the chip product ID register, and per-channel PWM
and thermal cooling parameters are configurable via devicetree child
nodes.

Move EMC2305_PWM_MAX into the driver, drop platform data support, and
remove the unused platform_data header file.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/hwmon/emc2305.c               | 44 +++++----------------------
 include/linux/platform_data/emc2305.h | 28 -----------------
 2 files changed, 8 insertions(+), 64 deletions(-)
 delete mode 100644 include/linux/platform_data/emc2305.h

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index 434e70e76f5f..4eee52ae38ca 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -9,7 +9,6 @@
 #include <linux/hwmon.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/platform_data/emc2305.h>
 #include <linux/thermal.h>
 #include <linux/pwm.h>
 #include <linux/of_device.h>
@@ -20,6 +19,7 @@
 #define EMC2305_FAN_MAX			0xff
 #define EMC2305_FAN_MIN			0x00
 #define EMC2305_FAN_MAX_STATE		10
+#define EMC2305_PWM_MAX			5
 #define EMC2305_DEVICE			0x34
 #define EMC2305_VENDOR			0x5d
 #define EMC2305_REG_PRODUCT_ID		0xfd
@@ -627,7 +627,6 @@ static int emc2305_probe(struct i2c_client *client)
 	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct emc2305_data *data;
-	struct emc2305_platform_data *pdata;
 	int vendor;
 	int ret;
 	int i;
@@ -657,43 +656,16 @@ static int emc2305_probe(struct i2c_client *client)
 
 	pwm_childs = emc2305_probe_childs_from_dt(dev);
 
-	pdata = dev_get_platdata(&client->dev);
+	data->max_state = EMC2305_FAN_MAX_STATE;
+	data->pwm_separate = false;
+	for (i = 0; i < EMC2305_PWM_MAX; i++)
+		data->pwm_min[i] = EMC2305_FAN_MIN;
 
 	if (!pwm_childs) {
-		if (pdata) {
-			if (!pdata->max_state || pdata->max_state > EMC2305_FAN_MAX_STATE)
-				return -EINVAL;
-			data->max_state = pdata->max_state;
-			/*
-			 * Validate a number of active PWM channels. Note that
-			 * configured number can be less than the actual maximum
-			 * supported by the device.
-			 */
-			if (!pdata->pwm_num || pdata->pwm_num > EMC2305_PWM_MAX)
-				return -EINVAL;
-			data->pwm_num = pdata->pwm_num;
-			data->pwm_output_mask = pdata->pwm_output_mask;
-			data->pwm_polarity_mask = pdata->pwm_polarity_mask;
-			data->pwm_separate = pdata->pwm_separate;
-			for (i = 0; i < EMC2305_PWM_MAX; i++) {
-				data->pwm_min[i] = pdata->pwm_min[i];
-				data->pwm_freq[i] = pdata->pwm_freq[i];
-			}
-		} else {
-			data->max_state = EMC2305_FAN_MAX_STATE;
-			data->pwm_separate = false;
-			data->pwm_output_mask = EMC2305_DEFAULT_OUTPUT;
-			data->pwm_polarity_mask = EMC2305_DEFAULT_POLARITY;
-			for (i = 0; i < EMC2305_PWM_MAX; i++) {
-				data->pwm_min[i] = EMC2305_FAN_MIN;
-				data->pwm_freq[i] = base_freq_table[3];
-			}
-		}
-	} else {
-		data->max_state = EMC2305_FAN_MAX_STATE;
-		data->pwm_separate = false;
+		data->pwm_output_mask = EMC2305_DEFAULT_OUTPUT;
+		data->pwm_polarity_mask = EMC2305_DEFAULT_POLARITY;
 		for (i = 0; i < EMC2305_PWM_MAX; i++)
-			data->pwm_min[i] = EMC2305_FAN_MIN;
+			data->pwm_freq[i] = base_freq_table[3];
 	}
 
 	data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "emc2305", data,
diff --git a/include/linux/platform_data/emc2305.h b/include/linux/platform_data/emc2305.h
deleted file mode 100644
index 76043a97f975..000000000000
--- a/include/linux/platform_data/emc2305.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef __LINUX_PLATFORM_DATA_EMC2305__
-#define __LINUX_PLATFORM_DATA_EMC2305__
-
-#define EMC2305_PWM_MAX	5
-
-/**
- * struct emc2305_platform_data - EMC2305 driver platform data
- * @max_state: maximum cooling state of the cooling device;
- * @pwm_num: number of active channels;
- * @pwm_output_mask: PWM output mask
- * @pwm_polarity_mask: PWM polarity mask
- * @pwm_separate: separate PWM settings for every channel;
- * @pwm_min: array of minimum PWM per channel;
- * @pwm_freq: array of PWM frequency per channel
- */
-struct emc2305_platform_data {
-	u8 max_state;
-	u8 pwm_num;
-	u8 pwm_output_mask;
-	u8 pwm_polarity_mask;
-	bool pwm_separate;
-	u8 pwm_min[EMC2305_PWM_MAX];
-	u16 pwm_freq[EMC2305_PWM_MAX];
-};
-
-#endif
-- 
2.45.2


  parent reply	other threads:[~2026-11-10 18:36 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 18:34 [PATCH 00/10] hwmon: Drop unused platform data support and max197 driver Guenter Roeck
2026-11-10 18:34 ` [PATCH 01/10] hwmon: (ads7828) Drop platform data support Guenter Roeck
2026-11-10 18:45   ` Arnd Bergmann
2026-11-10 19:40     ` Guenter Roeck
2026-11-10 19:49       ` Arnd Bergmann
2026-11-12 18:25     ` Guenter Roeck
2026-11-10 18:34 ` Guenter Roeck [this message]
2026-11-10 18:56   ` [PATCH 02/10] hwmon: (emc2305) " Arnd Bergmann
2026-11-12 19:06     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 03/10] hwmon: (g762) " Guenter Roeck
2026-11-10 19:09   ` Arnd Bergmann
2026-11-12 19:08     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 04/10] hwmon: (gsc-hwmon) " Guenter Roeck
2026-11-10 19:11   ` Arnd Bergmann
2026-11-12 19:09     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 05/10] hwmon: (ltc4245) " Guenter Roeck
2026-11-10 18:58   ` Arnd Bergmann
2026-11-12 19:11     ` Guenter Roeck
2026-11-11  9:54   ` Nuno Sá
2026-11-10 18:34 ` [PATCH 06/10] hwmon: (mcp3021) " Guenter Roeck
2026-11-10 19:12   ` Arnd Bergmann
2026-11-12 19:14     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 07/10] hwmon: (shtc1) " Guenter Roeck
2026-11-10 19:00   ` Arnd Bergmann
2026-11-12 19:18     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 08/10] hwmon: (max197) Remove driver Guenter Roeck
2026-11-10 19:02   ` Arnd Bergmann
2026-11-12 19:22     ` Guenter Roeck
2026-11-11  9:49   ` Nuno Sá
2026-11-10 18:34 ` [PATCH 09/10] hwmon: (f75375s) Drop platform data support Guenter Roeck
2026-11-10 19:18   ` Arnd Bergmann
2026-11-10 19:43     ` Guenter Roeck
2026-11-12 19:25     ` Guenter Roeck
2026-11-10 18:34 ` [PATCH 10/10] hwmon: (ds620) " Guenter Roeck
2026-11-10 19:07   ` Arnd Bergmann
2026-11-10 19:41     ` Guenter Roeck
2026-11-12 19:29     ` Guenter Roeck
2026-11-11  9:56   ` Nuno Sá
2026-11-10 19:24 ` [PATCH 00/10] hwmon: Drop unused platform data support and max197 driver Arnd Bergmann
2026-11-10 19:50   ` Guenter Roeck
2026-11-10 20:31     ` Arnd Bergmann
2026-11-12 19:31   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261110183434.181711-3-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=arnd@arndb.de \
    --cc=linux-hwmon@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.