pwm: lpss: Deduplicate board info data structures
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 27 Sep 2022 16:24:15 +0000 (19:24 +0300)
committerThierry Reding <thierry.reding@gmail.com>
Wed, 28 Sep 2022 14:01:30 +0000 (16:01 +0200)
Move the board info structures from the glue drivers to the
common library and hence deduplicate configuration data.

For the Intel Braswell case the ACPI version should be used.
Because switch to ACPI/PCI is done in BIOS while quite likely
the rest of AML code is the same, meaning similar issue might
be observed. There is no bug report due to no PCI enabled device
in the wild, Andy thinks, and only reference boards can be tested,
so nobody really cares about Intel Braswell PCI case.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/pwm/pwm-lpss-pci.c
drivers/pwm/pwm-lpss-platform.c
drivers/pwm/pwm-lpss.c
drivers/pwm/pwm-lpss.h

index c893ec3d2fb43b8ecc04e6dca76927ac3d2c6239..75b778e839b3dfd2ccdcacb2d672c737306ec71f 100644 (file)
 
 #include "pwm-lpss.h"
 
-/* BayTrail */
-static const struct pwm_lpss_boardinfo pwm_lpss_byt_info = {
-       .clk_rate = 25000000,
-       .npwm = 1,
-       .base_unit_bits = 16,
-};
-
-/* Braswell */
-static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = {
-       .clk_rate = 19200000,
-       .npwm = 1,
-       .base_unit_bits = 16,
-};
-
-/* Broxton */
-static const struct pwm_lpss_boardinfo pwm_lpss_bxt_info = {
-       .clk_rate = 19200000,
-       .npwm = 4,
-       .base_unit_bits = 22,
-       .bypass = true,
-};
-
-/* Tangier */
-static const struct pwm_lpss_boardinfo pwm_lpss_tng_info = {
-       .clk_rate = 19200000,
-       .npwm = 4,
-       .base_unit_bits = 22,
-};
-
 static int pwm_lpss_probe_pci(struct pci_dev *pdev,
                              const struct pci_device_id *id)
 {
index 928570430cef7599b1e72c58e793dfef1b26f3dc..834423c34f4817e33962074c83ced30e6fabdc69 100644 (file)
 
 #include "pwm-lpss.h"
 
-/* BayTrail */
-static const struct pwm_lpss_boardinfo pwm_lpss_byt_info = {
-       .clk_rate = 25000000,
-       .npwm = 1,
-       .base_unit_bits = 16,
-};
-
-/* Braswell */
-static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = {
-       .clk_rate = 19200000,
-       .npwm = 1,
-       .base_unit_bits = 16,
-       .other_devices_aml_touches_pwm_regs = true,
-};
-
-/* Broxton */
-static const struct pwm_lpss_boardinfo pwm_lpss_bxt_info = {
-       .clk_rate = 19200000,
-       .npwm = 4,
-       .base_unit_bits = 22,
-       .bypass = true,
-};
 
 static int pwm_lpss_probe_platform(struct platform_device *pdev)
 {
index 36d4e83e6b7901665cf123373bdf2e2be2b6afc6..9537aefd254a06b584c1f503262f0c04b69e19b7 100644 (file)
 /* Size of each PWM register space if multiple */
 #define PWM_SIZE                       0x400
 
+/* BayTrail */
+const struct pwm_lpss_boardinfo pwm_lpss_byt_info = {
+       .clk_rate = 25000000,
+       .npwm = 1,
+       .base_unit_bits = 16,
+};
+EXPORT_SYMBOL_GPL(pwm_lpss_byt_info);
+
+/* Braswell */
+const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = {
+       .clk_rate = 19200000,
+       .npwm = 1,
+       .base_unit_bits = 16,
+       .other_devices_aml_touches_pwm_regs = true,
+};
+EXPORT_SYMBOL_GPL(pwm_lpss_bsw_info);
+
+/* Broxton */
+const struct pwm_lpss_boardinfo pwm_lpss_bxt_info = {
+       .clk_rate = 19200000,
+       .npwm = 4,
+       .base_unit_bits = 22,
+       .bypass = true,
+};
+EXPORT_SYMBOL_GPL(pwm_lpss_bxt_info);
+
+/* Tangier */
+const struct pwm_lpss_boardinfo pwm_lpss_tng_info = {
+       .clk_rate = 19200000,
+       .npwm = 4,
+       .base_unit_bits = 22,
+};
+EXPORT_SYMBOL_GPL(pwm_lpss_tng_info);
+
 static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip)
 {
        return container_of(chip, struct pwm_lpss_chip, chip);
index 8b3476f25e066cfd287d32c503b90ff8900eab66..9ea5b145a353f5909913e679ba06b1353b614114 100644 (file)
@@ -33,6 +33,11 @@ struct pwm_lpss_boardinfo {
        bool other_devices_aml_touches_pwm_regs;
 };
 
+extern const struct pwm_lpss_boardinfo pwm_lpss_byt_info;
+extern const struct pwm_lpss_boardinfo pwm_lpss_bsw_info;
+extern const struct pwm_lpss_boardinfo pwm_lpss_bxt_info;
+extern const struct pwm_lpss_boardinfo pwm_lpss_tng_info;
+
 struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r,
                                     const struct pwm_lpss_boardinfo *info);