* [PATCH v4 0/1] hwmon: npcm: add Arbel NPCM8XX support @ 2023-10-31 7:58 ` Tomer Maimon 0 siblings, 0 replies; 6+ messages in thread From: Tomer Maimon @ 2023-10-31 7:58 UTC (permalink / raw) To: linux, jdelvare, avifishman70, tali.perry1, joel, andrew, venture, yuenn, benjaminfair, j.neuschaefer Cc: openbmc, linux-hwmon, linux-kernel, Tomer Maimon This patch set adds Arbel NPCM8XX Pulse Width Modulation (PWM) and Fan tachometer (Fan) support to PWM FAN NPCM driver. The NPCM8XX supports up to 16 Fan tachometer inputs and up to 12 PWM outputs. The NPCM PWM FAN driver was tested on the NPCM845 evaluation board. Addressed comments from: - Guenter Roeck : https://www.spinics.net/lists/linux-hwmon/msg21914.html Changes since version 3: - Moving the visible handle to the npcm7xx_pwm_is_visible function. - Modify the commit message. Changes since version 2: - dt-binding commit applied and remove from the patchset. - Using _is_visible() function to support NPCM8XX. Changes since version 1: - Add Rob Ack to the dt-binding commit. Tomer Maimon (1): hwmon: npcm750-pwm-fan: Add NPCM8xx support drivers/hwmon/npcm750-pwm-fan.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 0/1] hwmon: npcm: add Arbel NPCM8XX support @ 2023-10-31 7:58 ` Tomer Maimon 0 siblings, 0 replies; 6+ messages in thread From: Tomer Maimon @ 2023-10-31 7:58 UTC (permalink / raw) To: linux, jdelvare, avifishman70, tali.perry1, joel, andrew, venture, yuenn, benjaminfair, j.neuschaefer Cc: linux-hwmon, openbmc, linux-kernel, Tomer Maimon This patch set adds Arbel NPCM8XX Pulse Width Modulation (PWM) and Fan tachometer (Fan) support to PWM FAN NPCM driver. The NPCM8XX supports up to 16 Fan tachometer inputs and up to 12 PWM outputs. The NPCM PWM FAN driver was tested on the NPCM845 evaluation board. Addressed comments from: - Guenter Roeck : https://www.spinics.net/lists/linux-hwmon/msg21914.html Changes since version 3: - Moving the visible handle to the npcm7xx_pwm_is_visible function. - Modify the commit message. Changes since version 2: - dt-binding commit applied and remove from the patchset. - Using _is_visible() function to support NPCM8XX. Changes since version 1: - Add Rob Ack to the dt-binding commit. Tomer Maimon (1): hwmon: npcm750-pwm-fan: Add NPCM8xx support drivers/hwmon/npcm750-pwm-fan.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) -- 2.33.0 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support 2023-10-31 7:58 ` Tomer Maimon @ 2023-10-31 7:58 ` Tomer Maimon -1 siblings, 0 replies; 6+ messages in thread From: Tomer Maimon @ 2023-10-31 7:58 UTC (permalink / raw) To: linux, jdelvare, avifishman70, tali.perry1, joel, andrew, venture, yuenn, benjaminfair, j.neuschaefer Cc: openbmc, linux-hwmon, linux-kernel, Tomer Maimon Adding Pulse Width Modulation (PWM) and fan tacho NPCM8xx support to NPCM PWM and fan tacho driver. NPCM8xx uses a different number of PWM devices. As part of adding NPCM8XX support: - Add NPCM8xx specific compatible string. - Add data to handle architecture-specific PWM parameters. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> --- drivers/hwmon/npcm750-pwm-fan.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 10ed3f4335d4..d99b24c23d25 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -46,9 +46,9 @@ #define NPCM7XX_PWM_CTRL_CH3_EN_BIT BIT(16) /* Define the maximum PWM channel number */ -#define NPCM7XX_PWM_MAX_CHN_NUM 8 +#define NPCM7XX_PWM_MAX_CHN_NUM 12 #define NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE 4 -#define NPCM7XX_PWM_MAX_MODULES 2 +#define NPCM7XX_PWM_MAX_MODULES 3 /* Define the Counter Register, value = 100 for match 100% */ #define NPCM7XX_PWM_COUNTER_DEFAULT_NUM 255 @@ -171,6 +171,10 @@ #define FAN_PREPARE_TO_GET_FIRST_CAPTURE 0x01 #define FAN_ENOUGH_SAMPLE 0x02 +struct npcm_hwmon_info { + u32 pwm_max_channel; +}; + struct npcm7xx_fan_dev { u8 fan_st_flg; u8 fan_pls_per_rev; @@ -204,6 +208,7 @@ struct npcm7xx_pwm_fan_data { struct timer_list fan_timer; struct npcm7xx_fan_dev fan_dev[NPCM7XX_FAN_MAX_CHN_NUM]; struct npcm7xx_cooling_device *cdev[NPCM7XX_PWM_MAX_CHN_NUM]; + const struct npcm_hwmon_info *info; u8 fan_select; }; @@ -542,7 +547,7 @@ static umode_t npcm7xx_pwm_is_visible(const void *_data, u32 attr, int channel) { const struct npcm7xx_pwm_fan_data *data = _data; - if (!data->pwm_present[channel]) + if (!data->pwm_present[channel] || channel >= data->info->pwm_max_channel) return 0; switch (attr) { @@ -638,6 +643,10 @@ static const struct hwmon_channel_info * const npcm7xx_info[] = { HWMON_PWM_INPUT, HWMON_PWM_INPUT, HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, HWMON_PWM_INPUT), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, @@ -670,6 +679,14 @@ static const struct hwmon_chip_info npcm7xx_chip_info = { .info = npcm7xx_info, }; +static const struct npcm_hwmon_info npxm7xx_hwmon_info = { + .pwm_max_channel = 8, +}; + +static const struct npcm_hwmon_info npxm8xx_hwmon_info = { + .pwm_max_channel = 12, +}; + static u32 npcm7xx_pwm_init(struct npcm7xx_pwm_fan_data *data) { int m, ch; @@ -923,6 +940,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) if (!data) return -ENOMEM; + data->info = device_get_match_data(dev); + if (!data->info) + return -EINVAL; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"); if (!res) { dev_err(dev, "pwm resource not found\n"); @@ -1015,7 +1036,8 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) } static const struct of_device_id of_pwm_fan_match_table[] = { - { .compatible = "nuvoton,npcm750-pwm-fan", }, + { .compatible = "nuvoton,npcm750-pwm-fan", .data = &npxm7xx_hwmon_info}, + { .compatible = "nuvoton,npcm845-pwm-fan", .data = &npxm8xx_hwmon_info}, {}, }; MODULE_DEVICE_TABLE(of, of_pwm_fan_match_table); -- 2.33.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support @ 2023-10-31 7:58 ` Tomer Maimon 0 siblings, 0 replies; 6+ messages in thread From: Tomer Maimon @ 2023-10-31 7:58 UTC (permalink / raw) To: linux, jdelvare, avifishman70, tali.perry1, joel, andrew, venture, yuenn, benjaminfair, j.neuschaefer Cc: linux-hwmon, openbmc, linux-kernel, Tomer Maimon Adding Pulse Width Modulation (PWM) and fan tacho NPCM8xx support to NPCM PWM and fan tacho driver. NPCM8xx uses a different number of PWM devices. As part of adding NPCM8XX support: - Add NPCM8xx specific compatible string. - Add data to handle architecture-specific PWM parameters. Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> --- drivers/hwmon/npcm750-pwm-fan.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/npcm750-pwm-fan.c b/drivers/hwmon/npcm750-pwm-fan.c index 10ed3f4335d4..d99b24c23d25 100644 --- a/drivers/hwmon/npcm750-pwm-fan.c +++ b/drivers/hwmon/npcm750-pwm-fan.c @@ -46,9 +46,9 @@ #define NPCM7XX_PWM_CTRL_CH3_EN_BIT BIT(16) /* Define the maximum PWM channel number */ -#define NPCM7XX_PWM_MAX_CHN_NUM 8 +#define NPCM7XX_PWM_MAX_CHN_NUM 12 #define NPCM7XX_PWM_MAX_CHN_NUM_IN_A_MODULE 4 -#define NPCM7XX_PWM_MAX_MODULES 2 +#define NPCM7XX_PWM_MAX_MODULES 3 /* Define the Counter Register, value = 100 for match 100% */ #define NPCM7XX_PWM_COUNTER_DEFAULT_NUM 255 @@ -171,6 +171,10 @@ #define FAN_PREPARE_TO_GET_FIRST_CAPTURE 0x01 #define FAN_ENOUGH_SAMPLE 0x02 +struct npcm_hwmon_info { + u32 pwm_max_channel; +}; + struct npcm7xx_fan_dev { u8 fan_st_flg; u8 fan_pls_per_rev; @@ -204,6 +208,7 @@ struct npcm7xx_pwm_fan_data { struct timer_list fan_timer; struct npcm7xx_fan_dev fan_dev[NPCM7XX_FAN_MAX_CHN_NUM]; struct npcm7xx_cooling_device *cdev[NPCM7XX_PWM_MAX_CHN_NUM]; + const struct npcm_hwmon_info *info; u8 fan_select; }; @@ -542,7 +547,7 @@ static umode_t npcm7xx_pwm_is_visible(const void *_data, u32 attr, int channel) { const struct npcm7xx_pwm_fan_data *data = _data; - if (!data->pwm_present[channel]) + if (!data->pwm_present[channel] || channel >= data->info->pwm_max_channel) return 0; switch (attr) { @@ -638,6 +643,10 @@ static const struct hwmon_channel_info * const npcm7xx_info[] = { HWMON_PWM_INPUT, HWMON_PWM_INPUT, HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, + HWMON_PWM_INPUT, HWMON_PWM_INPUT), HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT, @@ -670,6 +679,14 @@ static const struct hwmon_chip_info npcm7xx_chip_info = { .info = npcm7xx_info, }; +static const struct npcm_hwmon_info npxm7xx_hwmon_info = { + .pwm_max_channel = 8, +}; + +static const struct npcm_hwmon_info npxm8xx_hwmon_info = { + .pwm_max_channel = 12, +}; + static u32 npcm7xx_pwm_init(struct npcm7xx_pwm_fan_data *data) { int m, ch; @@ -923,6 +940,10 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) if (!data) return -ENOMEM; + data->info = device_get_match_data(dev); + if (!data->info) + return -EINVAL; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"); if (!res) { dev_err(dev, "pwm resource not found\n"); @@ -1015,7 +1036,8 @@ static int npcm7xx_pwm_fan_probe(struct platform_device *pdev) } static const struct of_device_id of_pwm_fan_match_table[] = { - { .compatible = "nuvoton,npcm750-pwm-fan", }, + { .compatible = "nuvoton,npcm750-pwm-fan", .data = &npxm7xx_hwmon_info}, + { .compatible = "nuvoton,npcm845-pwm-fan", .data = &npxm8xx_hwmon_info}, {}, }; MODULE_DEVICE_TABLE(of, of_pwm_fan_match_table); -- 2.33.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support 2023-10-31 7:58 ` Tomer Maimon @ 2023-11-02 3:14 ` Guenter Roeck -1 siblings, 0 replies; 6+ messages in thread From: Guenter Roeck @ 2023-11-02 3:14 UTC (permalink / raw) To: Tomer Maimon Cc: jdelvare, avifishman70, tali.perry1, joel, andrew, venture, yuenn, benjaminfair, j.neuschaefer, openbmc, linux-hwmon, linux-kernel On Tue, Oct 31, 2023 at 09:58:06AM +0200, Tomer Maimon wrote: > Adding Pulse Width Modulation (PWM) and fan tacho NPCM8xx support to > NPCM PWM and fan tacho driver. > NPCM8xx uses a different number of PWM devices. > > As part of adding NPCM8XX support: > - Add NPCM8xx specific compatible string. > - Add data to handle architecture-specific PWM parameters. > > Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Applied to hwmon-next. I'll push it after the relase window closes. Side note: An introductory patch is not necessary for single patches. Providing the change log in the unnecessary intro patch only adds additional overhead for no gain. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support @ 2023-11-02 3:14 ` Guenter Roeck 0 siblings, 0 replies; 6+ messages in thread From: Guenter Roeck @ 2023-11-02 3:14 UTC (permalink / raw) To: Tomer Maimon Cc: linux-hwmon, jdelvare, benjaminfair, avifishman70, venture, openbmc, j.neuschaefer, tali.perry1, joel, linux-kernel On Tue, Oct 31, 2023 at 09:58:06AM +0200, Tomer Maimon wrote: > Adding Pulse Width Modulation (PWM) and fan tacho NPCM8xx support to > NPCM PWM and fan tacho driver. > NPCM8xx uses a different number of PWM devices. > > As part of adding NPCM8XX support: > - Add NPCM8xx specific compatible string. > - Add data to handle architecture-specific PWM parameters. > > Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> Applied to hwmon-next. I'll push it after the relase window closes. Side note: An introductory patch is not necessary for single patches. Providing the change log in the unnecessary intro patch only adds additional overhead for no gain. Guenter ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-02 3:15 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-10-31 7:58 [PATCH v4 0/1] hwmon: npcm: add Arbel NPCM8XX support Tomer Maimon 2023-10-31 7:58 ` Tomer Maimon 2023-10-31 7:58 ` [PATCH v4 1/1] hwmon: npcm750-pwm-fan: Add NPCM8xx support Tomer Maimon 2023-10-31 7:58 ` Tomer Maimon 2023-11-02 3:14 ` Guenter Roeck 2023-11-02 3:14 ` Guenter Roeck
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.