forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/hsi/controllers/omap_ssi_core.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* OMAP SSI driver.
23 *
34 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
45 * Copyright (C) 2014 Sebastian Reichel <sre@kernel.org>
56 *
67 * Contact: Carlos Chinea <carlos.chinea@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
218 */
229
2310 #include <linux/compiler.h>
....@@ -48,7 +35,7 @@
4835 static DEFINE_IDA(platform_omap_ssi_ida);
4936
5037 #ifdef CONFIG_DEBUG_FS
51
-static int ssi_debug_show(struct seq_file *m, void *p __maybe_unused)
38
+static int ssi_regs_show(struct seq_file *m, void *p __maybe_unused)
5239 {
5340 struct hsi_controller *ssi = m->private;
5441 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
....@@ -63,7 +50,7 @@
6350 return 0;
6451 }
6552
66
-static int ssi_debug_gdd_show(struct seq_file *m, void *p __maybe_unused)
53
+static int ssi_gdd_regs_show(struct seq_file *m, void *p __maybe_unused)
6754 {
6855 struct hsi_controller *ssi = m->private;
6956 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
....@@ -117,29 +104,8 @@
117104 return 0;
118105 }
119106
120
-static int ssi_regs_open(struct inode *inode, struct file *file)
121
-{
122
- return single_open(file, ssi_debug_show, inode->i_private);
123
-}
124
-
125
-static int ssi_gdd_regs_open(struct inode *inode, struct file *file)
126
-{
127
- return single_open(file, ssi_debug_gdd_show, inode->i_private);
128
-}
129
-
130
-static const struct file_operations ssi_regs_fops = {
131
- .open = ssi_regs_open,
132
- .read = seq_read,
133
- .llseek = seq_lseek,
134
- .release = single_release,
135
-};
136
-
137
-static const struct file_operations ssi_gdd_regs_fops = {
138
- .open = ssi_gdd_regs_open,
139
- .read = seq_read,
140
- .llseek = seq_lseek,
141
- .release = single_release,
142
-};
107
+DEFINE_SHOW_ATTRIBUTE(ssi_regs);
108
+DEFINE_SHOW_ATTRIBUTE(ssi_gdd_regs);
143109
144110 static int ssi_debug_add_ctrl(struct hsi_controller *ssi)
145111 {
....@@ -330,7 +296,7 @@
330296 break;
331297 case ABORT_RATE_CHANGE:
332298 dev_dbg(&ssi->device, "abort rate change\n");
333
- /* Fall through */
299
+ fallthrough;
334300 case POST_RATE_CHANGE:
335301 dev_dbg(&ssi->device, "post rate change (%lu -> %lu)\n",
336302 clk_data->old_rate, clk_data->new_rate);
....@@ -404,10 +370,8 @@
404370 if (err < 0)
405371 goto out_err;
406372 err = platform_get_irq_byname(pd, "gdd_mpu");
407
- if (err < 0) {
408
- dev_err(&pd->dev, "GDD IRQ resource missing\n");
373
+ if (err < 0)
409374 goto out_err;
410
- }
411375 omap_ssi->gdd_irq = err;
412376 tasklet_init(&omap_ssi->gdd_tasklet, ssi_gdd_tasklet,
413377 (unsigned long)ssi);
....@@ -460,7 +424,7 @@
460424 struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
461425 int err;
462426
463
- err = pm_runtime_get_sync(ssi->device.parent);
427
+ err = pm_runtime_resume_and_get(ssi->device.parent);
464428 if (err < 0) {
465429 dev_err(&ssi->device, "runtime PM failed %d\n", err);
466430 return err;
....@@ -560,6 +524,7 @@
560524 if (!childpdev) {
561525 err = -ENODEV;
562526 dev_err(&pd->dev, "failed to create ssi controller port\n");
527
+ of_node_put(child);
563528 goto out3;
564529 }
565530 }