diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2019-05-22 15:47:22 -0400 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2019-05-27 01:23:00 -0400 |
commit | 3424305b8be456a8e23c951b8c9aebad0c765ff7 (patch) | |
tree | e34697a6a17114db8bfbedadc28a19777fc9c805 | |
parent | 446701d1d161f04aa107903bfe7ec14e1f6cd17f (diff) |
soundwire: rename 'freq' fields
Rename all fields with 'freq' as 'clk_freq' to follow the MIPI
specification and avoid confusion between bus clock and audio clocks.
No functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r-- | drivers/soundwire/bus.c | 4 | ||||
-rw-r--r-- | drivers/soundwire/intel.c | 11 | ||||
-rw-r--r-- | drivers/soundwire/mipi_disco.c | 23 | ||||
-rw-r--r-- | drivers/soundwire/stream.c | 2 | ||||
-rw-r--r-- | include/linux/soundwire/sdw.h | 12 |
5 files changed, 27 insertions, 25 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index aac35fc3cf22..96e42df8f458 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c | |||
@@ -87,7 +87,7 @@ int sdw_add_bus_master(struct sdw_bus *bus) | |||
87 | 87 | ||
88 | /* | 88 | /* |
89 | * Initialize clock values based on Master properties. The max | 89 | * Initialize clock values based on Master properties. The max |
90 | * frequency is read from max_freq property. Current assumption | 90 | * frequency is read from max_clk_freq property. Current assumption |
91 | * is that the bus will start at highest clock frequency when | 91 | * is that the bus will start at highest clock frequency when |
92 | * powered on. | 92 | * powered on. |
93 | * | 93 | * |
@@ -95,7 +95,7 @@ int sdw_add_bus_master(struct sdw_bus *bus) | |||
95 | * to start with bank 0 (Table 40 of Spec) | 95 | * to start with bank 0 (Table 40 of Spec) |
96 | */ | 96 | */ |
97 | prop = &bus->prop; | 97 | prop = &bus->prop; |
98 | bus->params.max_dr_freq = prop->max_freq * SDW_DOUBLE_RATE_FACTOR; | 98 | bus->params.max_dr_freq = prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR; |
99 | bus->params.curr_dr_freq = bus->params.max_dr_freq; | 99 | bus->params.curr_dr_freq = bus->params.max_dr_freq; |
100 | bus->params.curr_bank = SDW_BANK0; | 100 | bus->params.curr_bank = SDW_BANK0; |
101 | bus->params.next_bank = SDW_BANK1; | 101 | bus->params.next_bank = SDW_BANK1; |
diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 31336b0271b0..4ac141730b13 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c | |||
@@ -796,13 +796,14 @@ static int intel_prop_read(struct sdw_bus *bus) | |||
796 | sdw_master_read_prop(bus); | 796 | sdw_master_read_prop(bus); |
797 | 797 | ||
798 | /* BIOS is not giving some values correctly. So, lets override them */ | 798 | /* BIOS is not giving some values correctly. So, lets override them */ |
799 | bus->prop.num_freq = 1; | 799 | bus->prop.num_clk_freq = 1; |
800 | bus->prop.freq = devm_kcalloc(bus->dev, bus->prop.num_freq, | 800 | bus->prop.clk_freq = devm_kcalloc(bus->dev, bus->prop.num_clk_freq, |
801 | sizeof(*bus->prop.freq), GFP_KERNEL); | 801 | sizeof(*bus->prop.clk_freq), |
802 | if (!bus->prop.freq) | 802 | GFP_KERNEL); |
803 | if (!bus->prop.clk_freq) | ||
803 | return -ENOMEM; | 804 | return -ENOMEM; |
804 | 805 | ||
805 | bus->prop.freq[0] = bus->prop.max_freq; | 806 | bus->prop.clk_freq[0] = bus->prop.max_clk_freq; |
806 | bus->prop.err_threshold = 5; | 807 | bus->prop.err_threshold = 5; |
807 | 808 | ||
808 | return 0; | 809 | return 0; |
diff --git a/drivers/soundwire/mipi_disco.c b/drivers/soundwire/mipi_disco.c index 6df68584c963..b1770af43fa8 100644 --- a/drivers/soundwire/mipi_disco.c +++ b/drivers/soundwire/mipi_disco.c | |||
@@ -58,31 +58,32 @@ int sdw_master_read_prop(struct sdw_bus *bus) | |||
58 | 58 | ||
59 | fwnode_property_read_u32(link, | 59 | fwnode_property_read_u32(link, |
60 | "mipi-sdw-max-clock-frequency", | 60 | "mipi-sdw-max-clock-frequency", |
61 | &prop->max_freq); | 61 | &prop->max_clk_freq); |
62 | 62 | ||
63 | nval = fwnode_property_read_u32_array(link, | 63 | nval = fwnode_property_read_u32_array(link, |
64 | "mipi-sdw-clock-frequencies-supported", NULL, 0); | 64 | "mipi-sdw-clock-frequencies-supported", NULL, 0); |
65 | if (nval > 0) { | 65 | if (nval > 0) { |
66 | prop->num_freq = nval; | 66 | prop->num_clk_freq = nval; |
67 | prop->freq = devm_kcalloc(bus->dev, prop->num_freq, | 67 | prop->clk_freq = devm_kcalloc(bus->dev, prop->num_clk_freq, |
68 | sizeof(*prop->freq), GFP_KERNEL); | 68 | sizeof(*prop->clk_freq), |
69 | if (!prop->freq) | 69 | GFP_KERNEL); |
70 | if (!prop->clk_freq) | ||
70 | return -ENOMEM; | 71 | return -ENOMEM; |
71 | 72 | ||
72 | fwnode_property_read_u32_array(link, | 73 | fwnode_property_read_u32_array(link, |
73 | "mipi-sdw-clock-frequencies-supported", | 74 | "mipi-sdw-clock-frequencies-supported", |
74 | prop->freq, prop->num_freq); | 75 | prop->clk_freq, prop->num_clk_freq); |
75 | } | 76 | } |
76 | 77 | ||
77 | /* | 78 | /* |
78 | * Check the frequencies supported. If FW doesn't provide max | 79 | * Check the frequencies supported. If FW doesn't provide max |
79 | * freq, then populate here by checking values. | 80 | * freq, then populate here by checking values. |
80 | */ | 81 | */ |
81 | if (!prop->max_freq && prop->freq) { | 82 | if (!prop->max_clk_freq && prop->clk_freq) { |
82 | prop->max_freq = prop->freq[0]; | 83 | prop->max_clk_freq = prop->clk_freq[0]; |
83 | for (i = 1; i < prop->num_freq; i++) { | 84 | for (i = 1; i < prop->num_clk_freq; i++) { |
84 | if (prop->freq[i] > prop->max_freq) | 85 | if (prop->clk_freq[i] > prop->max_clk_freq) |
85 | prop->max_freq = prop->freq[i]; | 86 | prop->max_clk_freq = prop->clk_freq[i]; |
86 | } | 87 | } |
87 | } | 88 | } |
88 | 89 | ||
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index d01060dbee96..89edc897b8eb 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c | |||
@@ -1474,7 +1474,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream) | |||
1474 | memcpy(¶ms, &bus->params, sizeof(params)); | 1474 | memcpy(¶ms, &bus->params, sizeof(params)); |
1475 | 1475 | ||
1476 | /* TODO: Support Asynchronous mode */ | 1476 | /* TODO: Support Asynchronous mode */ |
1477 | if ((prop->max_freq % stream->params.rate) != 0) { | 1477 | if ((prop->max_clk_freq % stream->params.rate) != 0) { |
1478 | dev_err(bus->dev, "Async mode not supported\n"); | 1478 | dev_err(bus->dev, "Async mode not supported\n"); |
1479 | return -EINVAL; | 1479 | return -EINVAL; |
1480 | } | 1480 | } |
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 14376d8458c3..c6ded0d7a9f2 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h | |||
@@ -365,11 +365,11 @@ struct sdw_slave_prop { | |||
365 | * struct sdw_master_prop - Master properties | 365 | * struct sdw_master_prop - Master properties |
366 | * @revision: MIPI spec version of the implementation | 366 | * @revision: MIPI spec version of the implementation |
367 | * @clk_stop_mode: Bitmap for Clock Stop modes supported | 367 | * @clk_stop_mode: Bitmap for Clock Stop modes supported |
368 | * @max_freq: Maximum Bus clock frequency, in Hz | 368 | * @max_clk_freq: Maximum Bus clock frequency, in Hz |
369 | * @num_clk_gears: Number of clock gears supported | 369 | * @num_clk_gears: Number of clock gears supported |
370 | * @clk_gears: Clock gears supported | 370 | * @clk_gears: Clock gears supported |
371 | * @num_freq: Number of clock frequencies supported, in Hz | 371 | * @num_clk_freq: Number of clock frequencies supported, in Hz |
372 | * @freq: Clock frequencies supported, in Hz | 372 | * @clk_freq: Clock frequencies supported, in Hz |
373 | * @default_frame_rate: Controller default Frame rate, in Hz | 373 | * @default_frame_rate: Controller default Frame rate, in Hz |
374 | * @default_row: Number of rows | 374 | * @default_row: Number of rows |
375 | * @default_col: Number of columns | 375 | * @default_col: Number of columns |
@@ -380,11 +380,11 @@ struct sdw_slave_prop { | |||
380 | struct sdw_master_prop { | 380 | struct sdw_master_prop { |
381 | u32 revision; | 381 | u32 revision; |
382 | enum sdw_clk_stop_mode clk_stop_mode; | 382 | enum sdw_clk_stop_mode clk_stop_mode; |
383 | u32 max_freq; | 383 | u32 max_clk_freq; |
384 | u32 num_clk_gears; | 384 | u32 num_clk_gears; |
385 | u32 *clk_gears; | 385 | u32 *clk_gears; |
386 | u32 num_freq; | 386 | u32 num_clk_freq; |
387 | u32 *freq; | 387 | u32 *clk_freq; |
388 | u32 default_frame_rate; | 388 | u32 default_frame_rate; |
389 | u32 default_row; | 389 | u32 default_row; |
390 | u32 default_col; | 390 | u32 default_col; |