hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/reset/reset-meson-audio-arb.c
....@@ -19,6 +19,11 @@
1919 spinlock_t lock;
2020 };
2121
22
+struct meson_audio_arb_match_data {
23
+ const unsigned int *reset_bits;
24
+ unsigned int reset_num;
25
+};
26
+
2227 #define ARB_GENERAL_BIT 31
2328
2429 static const unsigned int axg_audio_arb_reset_bits[] = {
....@@ -28,6 +33,27 @@
2833 [AXG_ARB_FRDDR_A] = 4,
2934 [AXG_ARB_FRDDR_B] = 5,
3035 [AXG_ARB_FRDDR_C] = 6,
36
+};
37
+
38
+static const struct meson_audio_arb_match_data axg_audio_arb_match = {
39
+ .reset_bits = axg_audio_arb_reset_bits,
40
+ .reset_num = ARRAY_SIZE(axg_audio_arb_reset_bits),
41
+};
42
+
43
+static const unsigned int sm1_audio_arb_reset_bits[] = {
44
+ [AXG_ARB_TODDR_A] = 0,
45
+ [AXG_ARB_TODDR_B] = 1,
46
+ [AXG_ARB_TODDR_C] = 2,
47
+ [AXG_ARB_FRDDR_A] = 4,
48
+ [AXG_ARB_FRDDR_B] = 5,
49
+ [AXG_ARB_FRDDR_C] = 6,
50
+ [AXG_ARB_TODDR_D] = 3,
51
+ [AXG_ARB_FRDDR_D] = 7,
52
+};
53
+
54
+static const struct meson_audio_arb_match_data sm1_audio_arb_match = {
55
+ .reset_bits = sm1_audio_arb_reset_bits,
56
+ .reset_num = ARRAY_SIZE(sm1_audio_arb_reset_bits),
3157 };
3258
3359 static int meson_audio_arb_update(struct reset_controller_dev *rcdev,
....@@ -82,7 +108,13 @@
82108 };
83109
84110 static const struct of_device_id meson_audio_arb_of_match[] = {
85
- { .compatible = "amlogic,meson-axg-audio-arb", },
111
+ {
112
+ .compatible = "amlogic,meson-axg-audio-arb",
113
+ .data = &axg_audio_arb_match,
114
+ }, {
115
+ .compatible = "amlogic,meson-sm1-audio-arb",
116
+ .data = &sm1_audio_arb_match,
117
+ },
86118 {}
87119 };
88120 MODULE_DEVICE_TABLE(of, meson_audio_arb_of_match);
....@@ -104,9 +136,14 @@
104136 static int meson_audio_arb_probe(struct platform_device *pdev)
105137 {
106138 struct device *dev = &pdev->dev;
139
+ const struct meson_audio_arb_match_data *data;
107140 struct meson_audio_arb_data *arb;
108141 struct resource *res;
109142 int ret;
143
+
144
+ data = of_device_get_match_data(dev);
145
+ if (!data)
146
+ return -EINVAL;
110147
111148 arb = devm_kzalloc(dev, sizeof(*arb), GFP_KERNEL);
112149 if (!arb)
....@@ -126,8 +163,8 @@
126163 return PTR_ERR(arb->regs);
127164
128165 spin_lock_init(&arb->lock);
129
- arb->reset_bits = axg_audio_arb_reset_bits;
130
- arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits);
166
+ arb->reset_bits = data->reset_bits;
167
+ arb->rstc.nr_resets = data->reset_num;
131168 arb->rstc.ops = &meson_audio_arb_rstc_ops;
132169 arb->rstc.of_node = dev->of_node;
133170 arb->rstc.owner = THIS_MODULE;