-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ASoC: Intel: Skylake: Parse nhlt and register clock device
When NHLT endpoint is present for a SSP then we create clock for that SSP. MCLK is consistent across endpoints and configuration for an SSP, so query only for first endpoint for an SSP. For SCLK/SCLKFS, the best fit is queried from the NHLT configurations which matches the clock rate requested. Best fit is decided based on below: 1. If rate matches with multiple configurations, then the first configuration is selected. 2. If for a selected fs and bits_per_sample, there are multiple endpoint configuration match, then the configuration with max number of channels is selected. So, the user has to set the rate which fits max number of channels So we create a platform device and pass clock information parsed as platform data. Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com> Signed-off-by: Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
- Loading branch information
Sriram Periyasamy
authored and
Mark Brown
committed
Nov 29, 2017
1 parent
38a5882
commit bc2bd45
Showing
5 changed files
with
395 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* skl-i2s.h - i2s blob mapping | ||
* | ||
* Copyright (C) 2017 Intel Corp | ||
* Author: Subhransu S. Prusty < subhransu.s.prusty@intel.com> | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* | ||
*/ | ||
|
||
#ifndef __SOUND_SOC_SKL_I2S_H | ||
#define __SOUND_SOC_SKL_I2S_H | ||
|
||
#define SKL_I2S_MAX_TIME_SLOTS 8 | ||
#define SKL_MCLK_DIV_CLK_SRC_MASK GENMASK(17, 16) | ||
|
||
#define SKL_MNDSS_DIV_CLK_SRC_MASK GENMASK(21, 20) | ||
#define SKL_SHIFT(x) (ffs(x) - 1) | ||
#define SKL_MCLK_DIV_RATIO_MASK GENMASK(11, 0) | ||
|
||
struct skl_i2s_config { | ||
u32 ssc0; | ||
u32 ssc1; | ||
u32 sscto; | ||
u32 sspsp; | ||
u32 sstsa; | ||
u32 ssrsa; | ||
u32 ssc2; | ||
u32 sspsp2; | ||
u32 ssc3; | ||
u32 ssioc; | ||
} __packed; | ||
|
||
struct skl_i2s_config_mclk { | ||
u32 mdivctrl; | ||
u32 mdivr; | ||
}; | ||
|
||
/** | ||
* struct skl_i2s_config_blob_legacy - Structure defines I2S Gateway | ||
* configuration legacy blob | ||
* | ||
* @gtw_attr: Gateway attribute for the I2S Gateway | ||
* @tdm_ts_group: TDM slot mapping against channels in the Gateway. | ||
* @i2s_cfg: I2S HW registers | ||
* @mclk: MCLK clock source and divider values | ||
*/ | ||
struct skl_i2s_config_blob_legacy { | ||
u32 gtw_attr; | ||
u32 tdm_ts_group[SKL_I2S_MAX_TIME_SLOTS]; | ||
struct skl_i2s_config i2s_cfg; | ||
struct skl_i2s_config_mclk mclk; | ||
}; | ||
|
||
#endif /* __SOUND_SOC_SKL_I2S_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* skl-ssp-clk.h - Skylake ssp clock information and ipc structure | ||
* | ||
* Copyright (C) 2017 Intel Corp | ||
* Author: Jaikrishna Nemallapudi <jaikrishnax.nemallapudi@intel.com> | ||
* Author: Subhransu S. Prusty <subhransu.s.prusty@intel.com> | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
* | ||
*/ | ||
|
||
#ifndef SOUND_SOC_SKL_SSP_CLK_H | ||
#define SOUND_SOC_SKL_SSP_CLK_H | ||
|
||
#define SKL_MAX_SSP 6 | ||
/* xtal/cardinal/pll, parent of ssp clocks and mclk */ | ||
#define SKL_MAX_CLK_SRC 3 | ||
#define SKL_MAX_SSP_CLK_TYPES 3 /* mclk, sclk, sclkfs */ | ||
|
||
#define SKL_MAX_CLK_CNT (SKL_MAX_SSP * SKL_MAX_SSP_CLK_TYPES) | ||
|
||
/* Max number of configurations supported for each clock */ | ||
#define SKL_MAX_CLK_RATES 10 | ||
|
||
#define SKL_SCLK_OFS SKL_MAX_SSP | ||
#define SKL_SCLKFS_OFS (SKL_SCLK_OFS + SKL_MAX_SSP) | ||
|
||
enum skl_clk_type { | ||
SKL_MCLK, | ||
SKL_SCLK, | ||
SKL_SCLK_FS, | ||
}; | ||
|
||
enum skl_clk_src_type { | ||
SKL_XTAL, | ||
SKL_CARDINAL, | ||
SKL_PLL, | ||
}; | ||
|
||
struct skl_clk_parent_src { | ||
u8 clk_id; | ||
const char *name; | ||
unsigned long rate; | ||
const char *parent_name; | ||
}; | ||
|
||
struct skl_clk_rate_cfg_table { | ||
unsigned long rate; | ||
void *config; | ||
}; | ||
|
||
/* | ||
* rate for mclk will be in rates[0]. For sclk and sclkfs, rates[] store | ||
* all possible clocks ssp can generate for that platform. | ||
*/ | ||
struct skl_ssp_clk { | ||
const char *name; | ||
const char *parent_name; | ||
struct skl_clk_rate_cfg_table rate_cfg[SKL_MAX_CLK_RATES]; | ||
}; | ||
|
||
struct skl_clk_pdata { | ||
struct skl_clk_parent_src *parent_clks; | ||
int num_clks; | ||
struct skl_ssp_clk *ssp_clks; | ||
void *pvt_data; | ||
}; | ||
|
||
#endif /* SOUND_SOC_SKL_SSP_CLK_H */ |
Oops, something went wrong.