Commit 3feecb1b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'char-misc-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char / misc driver fixes from Greg KH:
 "Here are some small char/misc driver fixes for 6.5-rc6 that resolve
  some reported issues. Included in here are:

   - bunch of iio driver fixes for reported problems

   - interconnect driver fixes

   - counter driver build fix

   - cardreader driver fixes

   - binder driver fixes

   - other tiny driver fixes

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'char-misc-6.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
  misc: tps6594-esm: Disable ESM for rev 1 PMIC
  misc: rtsx: judge ASPM Mode to set PETXCFG Reg
  binder: fix memory leak in binder_init()
  iio: cros_ec: Fix the allocation size for cros_ec_command
  tools/counter: Makefile: Replace rmdir by rm to avoid make,clean failure
  iio: imu: lsm6dsx: Fix mount matrix retrieval
  iio: adc: meson: fix core clock enable/disable moment
  iio: core: Prevent invalid memory access when there is no parent
  iio: frequency: admv1013: propagate errors from regulator_get_voltage()
  counter: Fix menuconfig "Counter support" submenu entries disappearance
  dt-bindings: iio: adi,ad74115: remove ref from -nanoamp
  iio: adc: ina2xx: avoid NULL pointer dereference on OF device match
  iio: light: bu27008: Fix intensity data type
  iio: light: bu27008: Fix scale format
  iio: light: bu27034: Fix scale format
  iio: adc: ad7192: Fix ac excitation feature
  interconnect: qcom: sa8775p: add enable_mask for bcm nodes
  interconnect: qcom: sm8550: add enable_mask for bcm nodes
  interconnect: qcom: sm8450: add enable_mask for bcm nodes
  interconnect: qcom: Add support for mask-based BCMs
  ...
parents 469a2f50 51a26bb0
...@@ -216,7 +216,6 @@ properties: ...@@ -216,7 +216,6 @@ properties:
description: Whether to enable burnout current for EXT1. description: Whether to enable burnout current for EXT1.
adi,ext1-burnout-current-nanoamp: adi,ext1-burnout-current-nanoamp:
$ref: /schemas/types.yaml#/definitions/uint32
description: description:
Burnout current in nanoamps to be applied to EXT1. Burnout current in nanoamps to be applied to EXT1.
enum: [0, 50, 500, 1000, 10000] enum: [0, 50, 500, 1000, 10000]
...@@ -233,7 +232,6 @@ properties: ...@@ -233,7 +232,6 @@ properties:
description: Whether to enable burnout current for EXT2. description: Whether to enable burnout current for EXT2.
adi,ext2-burnout-current-nanoamp: adi,ext2-burnout-current-nanoamp:
$ref: /schemas/types.yaml#/definitions/uint32
description: Burnout current in nanoamps to be applied to EXT2. description: Burnout current in nanoamps to be applied to EXT2.
enum: [0, 50, 500, 1000, 10000] enum: [0, 50, 500, 1000, 10000]
default: 0 default: 0
...@@ -249,7 +247,6 @@ properties: ...@@ -249,7 +247,6 @@ properties:
description: Whether to enable burnout current for VIOUT. description: Whether to enable burnout current for VIOUT.
adi,viout-burnout-current-nanoamp: adi,viout-burnout-current-nanoamp:
$ref: /schemas/types.yaml#/definitions/uint32
description: Burnout current in nanoamps to be applied to VIOUT. description: Burnout current in nanoamps to be applied to VIOUT.
enum: [0, 1000, 10000] enum: [0, 1000, 10000]
default: 0 default: 0
......
...@@ -6617,6 +6617,7 @@ static int __init binder_init(void) ...@@ -6617,6 +6617,7 @@ static int __init binder_init(void)
err_alloc_device_names_failed: err_alloc_device_names_failed:
debugfs_remove_recursive(binder_debugfs_dir_entry_root); debugfs_remove_recursive(binder_debugfs_dir_entry_root);
binder_alloc_shrinker_exit();
return ret; return ret;
} }
......
...@@ -1087,6 +1087,12 @@ int binder_alloc_shrinker_init(void) ...@@ -1087,6 +1087,12 @@ int binder_alloc_shrinker_init(void)
return ret; return ret;
} }
void binder_alloc_shrinker_exit(void)
{
unregister_shrinker(&binder_shrinker);
list_lru_destroy(&binder_alloc_lru);
}
/** /**
* check_buffer() - verify that buffer/offset is safe to access * check_buffer() - verify that buffer/offset is safe to access
* @alloc: binder_alloc for this proc * @alloc: binder_alloc for this proc
......
...@@ -129,6 +129,7 @@ extern struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc, ...@@ -129,6 +129,7 @@ extern struct binder_buffer *binder_alloc_new_buf(struct binder_alloc *alloc,
int pid); int pid);
extern void binder_alloc_init(struct binder_alloc *alloc); extern void binder_alloc_init(struct binder_alloc *alloc);
extern int binder_alloc_shrinker_init(void); extern int binder_alloc_shrinker_init(void);
extern void binder_alloc_shrinker_exit(void);
extern void binder_alloc_vma_close(struct binder_alloc *alloc); extern void binder_alloc_vma_close(struct binder_alloc *alloc);
extern struct binder_buffer * extern struct binder_buffer *
binder_alloc_prepare_to_free(struct binder_alloc *alloc, binder_alloc_prepare_to_free(struct binder_alloc *alloc,
......
...@@ -3,13 +3,6 @@ ...@@ -3,13 +3,6 @@
# Counter devices # Counter devices
# #
menuconfig COUNTER
tristate "Counter support"
help
This enables counter device support through the Generic Counter
interface. You only need to enable this, if you also want to enable
one or more of the counter device drivers below.
config I8254 config I8254
tristate tristate
select COUNTER select COUNTER
...@@ -25,6 +18,13 @@ config I8254 ...@@ -25,6 +18,13 @@ config I8254
If built as a module its name will be i8254. If built as a module its name will be i8254.
menuconfig COUNTER
tristate "Counter support"
help
This enables counter device support through the Generic Counter
interface. You only need to enable this, if you also want to enable
one or more of the counter device drivers below.
if COUNTER if COUNTER
config 104_QUAD_8 config 104_QUAD_8
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#define AD7192_MODE_STA_MASK BIT(20) /* Status Register transmission Mask */ #define AD7192_MODE_STA_MASK BIT(20) /* Status Register transmission Mask */
#define AD7192_MODE_CLKSRC(x) (((x) & 0x3) << 18) /* Clock Source Select */ #define AD7192_MODE_CLKSRC(x) (((x) & 0x3) << 18) /* Clock Source Select */
#define AD7192_MODE_SINC3 BIT(15) /* SINC3 Filter Select */ #define AD7192_MODE_SINC3 BIT(15) /* SINC3 Filter Select */
#define AD7192_MODE_ACX BIT(14) /* AC excitation enable(AD7195 only)*/
#define AD7192_MODE_ENPAR BIT(13) /* Parity Enable */ #define AD7192_MODE_ENPAR BIT(13) /* Parity Enable */
#define AD7192_MODE_CLKDIV BIT(12) /* Clock divide by 2 (AD7190/2 only)*/ #define AD7192_MODE_CLKDIV BIT(12) /* Clock divide by 2 (AD7190/2 only)*/
#define AD7192_MODE_SCYCLE BIT(11) /* Single cycle conversion */ #define AD7192_MODE_SCYCLE BIT(11) /* Single cycle conversion */
...@@ -91,6 +90,7 @@ ...@@ -91,6 +90,7 @@
/* Configuration Register Bit Designations (AD7192_REG_CONF) */ /* Configuration Register Bit Designations (AD7192_REG_CONF) */
#define AD7192_CONF_CHOP BIT(23) /* CHOP enable */ #define AD7192_CONF_CHOP BIT(23) /* CHOP enable */
#define AD7192_CONF_ACX BIT(22) /* AC excitation enable(AD7195 only) */
#define AD7192_CONF_REFSEL BIT(20) /* REFIN1/REFIN2 Reference Select */ #define AD7192_CONF_REFSEL BIT(20) /* REFIN1/REFIN2 Reference Select */
#define AD7192_CONF_CHAN(x) ((x) << 8) /* Channel select */ #define AD7192_CONF_CHAN(x) ((x) << 8) /* Channel select */
#define AD7192_CONF_CHAN_MASK (0x7FF << 8) /* Channel select mask */ #define AD7192_CONF_CHAN_MASK (0x7FF << 8) /* Channel select mask */
...@@ -472,7 +472,7 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev, ...@@ -472,7 +472,7 @@ static ssize_t ad7192_show_ac_excitation(struct device *dev,
struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ad7192_state *st = iio_priv(indio_dev); struct ad7192_state *st = iio_priv(indio_dev);
return sysfs_emit(buf, "%d\n", !!(st->mode & AD7192_MODE_ACX)); return sysfs_emit(buf, "%d\n", !!(st->conf & AD7192_CONF_ACX));
} }
static ssize_t ad7192_show_bridge_switch(struct device *dev, static ssize_t ad7192_show_bridge_switch(struct device *dev,
...@@ -513,13 +513,13 @@ static ssize_t ad7192_set(struct device *dev, ...@@ -513,13 +513,13 @@ static ssize_t ad7192_set(struct device *dev,
ad_sd_write_reg(&st->sd, AD7192_REG_GPOCON, 1, st->gpocon); ad_sd_write_reg(&st->sd, AD7192_REG_GPOCON, 1, st->gpocon);
break; break;
case AD7192_REG_MODE: case AD7192_REG_CONF:
if (val) if (val)
st->mode |= AD7192_MODE_ACX; st->conf |= AD7192_CONF_ACX;
else else
st->mode &= ~AD7192_MODE_ACX; st->conf &= ~AD7192_CONF_ACX;
ad_sd_write_reg(&st->sd, AD7192_REG_MODE, 3, st->mode); ad_sd_write_reg(&st->sd, AD7192_REG_CONF, 3, st->conf);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -579,12 +579,11 @@ static IIO_DEVICE_ATTR(bridge_switch_en, 0644, ...@@ -579,12 +579,11 @@ static IIO_DEVICE_ATTR(bridge_switch_en, 0644,
static IIO_DEVICE_ATTR(ac_excitation_en, 0644, static IIO_DEVICE_ATTR(ac_excitation_en, 0644,
ad7192_show_ac_excitation, ad7192_set, ad7192_show_ac_excitation, ad7192_set,
AD7192_REG_MODE); AD7192_REG_CONF);
static struct attribute *ad7192_attributes[] = { static struct attribute *ad7192_attributes[] = {
&iio_dev_attr_filter_low_pass_3db_frequency_available.dev_attr.attr, &iio_dev_attr_filter_low_pass_3db_frequency_available.dev_attr.attr,
&iio_dev_attr_bridge_switch_en.dev_attr.attr, &iio_dev_attr_bridge_switch_en.dev_attr.attr,
&iio_dev_attr_ac_excitation_en.dev_attr.attr,
NULL NULL
}; };
...@@ -595,6 +594,7 @@ static const struct attribute_group ad7192_attribute_group = { ...@@ -595,6 +594,7 @@ static const struct attribute_group ad7192_attribute_group = {
static struct attribute *ad7195_attributes[] = { static struct attribute *ad7195_attributes[] = {
&iio_dev_attr_filter_low_pass_3db_frequency_available.dev_attr.attr, &iio_dev_attr_filter_low_pass_3db_frequency_available.dev_attr.attr,
&iio_dev_attr_bridge_switch_en.dev_attr.attr, &iio_dev_attr_bridge_switch_en.dev_attr.attr,
&iio_dev_attr_ac_excitation_en.dev_attr.attr,
NULL NULL
}; };
......
...@@ -124,6 +124,7 @@ static const struct regmap_config ina2xx_regmap_config = { ...@@ -124,6 +124,7 @@ static const struct regmap_config ina2xx_regmap_config = {
enum ina2xx_ids { ina219, ina226 }; enum ina2xx_ids { ina219, ina226 };
struct ina2xx_config { struct ina2xx_config {
const char *name;
u16 config_default; u16 config_default;
int calibration_value; int calibration_value;
int shunt_voltage_lsb; /* nV */ int shunt_voltage_lsb; /* nV */
...@@ -155,6 +156,7 @@ struct ina2xx_chip_info { ...@@ -155,6 +156,7 @@ struct ina2xx_chip_info {
static const struct ina2xx_config ina2xx_config[] = { static const struct ina2xx_config ina2xx_config[] = {
[ina219] = { [ina219] = {
.name = "ina219",
.config_default = INA219_CONFIG_DEFAULT, .config_default = INA219_CONFIG_DEFAULT,
.calibration_value = 4096, .calibration_value = 4096,
.shunt_voltage_lsb = 10000, .shunt_voltage_lsb = 10000,
...@@ -164,6 +166,7 @@ static const struct ina2xx_config ina2xx_config[] = { ...@@ -164,6 +166,7 @@ static const struct ina2xx_config ina2xx_config[] = {
.chip_id = ina219, .chip_id = ina219,
}, },
[ina226] = { [ina226] = {
.name = "ina226",
.config_default = INA226_CONFIG_DEFAULT, .config_default = INA226_CONFIG_DEFAULT,
.calibration_value = 2048, .calibration_value = 2048,
.shunt_voltage_lsb = 2500, .shunt_voltage_lsb = 2500,
...@@ -996,7 +999,7 @@ static int ina2xx_probe(struct i2c_client *client) ...@@ -996,7 +999,7 @@ static int ina2xx_probe(struct i2c_client *client)
/* Patch the current config register with default. */ /* Patch the current config register with default. */
val = chip->config->config_default; val = chip->config->config_default;
if (id->driver_data == ina226) { if (type == ina226) {
ina226_set_average(chip, INA226_DEFAULT_AVG, &val); ina226_set_average(chip, INA226_DEFAULT_AVG, &val);
ina226_set_int_time_vbus(chip, INA226_DEFAULT_IT, &val); ina226_set_int_time_vbus(chip, INA226_DEFAULT_IT, &val);
ina226_set_int_time_vshunt(chip, INA226_DEFAULT_IT, &val); ina226_set_int_time_vshunt(chip, INA226_DEFAULT_IT, &val);
...@@ -1015,7 +1018,7 @@ static int ina2xx_probe(struct i2c_client *client) ...@@ -1015,7 +1018,7 @@ static int ina2xx_probe(struct i2c_client *client)
} }
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
if (id->driver_data == ina226) { if (type == ina226) {
indio_dev->channels = ina226_channels; indio_dev->channels = ina226_channels;
indio_dev->num_channels = ARRAY_SIZE(ina226_channels); indio_dev->num_channels = ARRAY_SIZE(ina226_channels);
indio_dev->info = &ina226_info; indio_dev->info = &ina226_info;
...@@ -1024,7 +1027,7 @@ static int ina2xx_probe(struct i2c_client *client) ...@@ -1024,7 +1027,7 @@ static int ina2xx_probe(struct i2c_client *client)
indio_dev->num_channels = ARRAY_SIZE(ina219_channels); indio_dev->num_channels = ARRAY_SIZE(ina219_channels);
indio_dev->info = &ina219_info; indio_dev->info = &ina219_info;
} }
indio_dev->name = id->name; indio_dev->name = id ? id->name : chip->config->name;
ret = devm_iio_kfifo_buffer_setup(&client->dev, indio_dev, ret = devm_iio_kfifo_buffer_setup(&client->dev, indio_dev,
&ina2xx_setup_ops); &ina2xx_setup_ops);
......
...@@ -916,12 +916,6 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) ...@@ -916,12 +916,6 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
goto err_vref; goto err_vref;
} }
ret = clk_prepare_enable(priv->core_clk);
if (ret) {
dev_err(dev, "failed to enable core clk\n");
goto err_core_clk;
}
regval = FIELD_PREP(MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, 1); regval = FIELD_PREP(MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, 1);
regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0, regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG0,
MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, regval); MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, regval);
...@@ -948,8 +942,6 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev) ...@@ -948,8 +942,6 @@ static int meson_sar_adc_hw_enable(struct iio_dev *indio_dev)
regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3, regmap_update_bits(priv->regmap, MESON_SAR_ADC_REG3,
MESON_SAR_ADC_REG3_ADC_EN, 0); MESON_SAR_ADC_REG3_ADC_EN, 0);
meson_sar_adc_set_bandgap(indio_dev, false); meson_sar_adc_set_bandgap(indio_dev, false);
clk_disable_unprepare(priv->core_clk);
err_core_clk:
regulator_disable(priv->vref); regulator_disable(priv->vref);
err_vref: err_vref:
meson_sar_adc_unlock(indio_dev); meson_sar_adc_unlock(indio_dev);
...@@ -977,8 +969,6 @@ static void meson_sar_adc_hw_disable(struct iio_dev *indio_dev) ...@@ -977,8 +969,6 @@ static void meson_sar_adc_hw_disable(struct iio_dev *indio_dev)
meson_sar_adc_set_bandgap(indio_dev, false); meson_sar_adc_set_bandgap(indio_dev, false);
clk_disable_unprepare(priv->core_clk);
regulator_disable(priv->vref); regulator_disable(priv->vref);
if (!ret) if (!ret)
...@@ -1211,7 +1201,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev) ...@@ -1211,7 +1201,7 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
if (IS_ERR(priv->clkin)) if (IS_ERR(priv->clkin))
return dev_err_probe(dev, PTR_ERR(priv->clkin), "failed to get clkin\n"); return dev_err_probe(dev, PTR_ERR(priv->clkin), "failed to get clkin\n");
priv->core_clk = devm_clk_get(dev, "core"); priv->core_clk = devm_clk_get_enabled(dev, "core");
if (IS_ERR(priv->core_clk)) if (IS_ERR(priv->core_clk))
return dev_err_probe(dev, PTR_ERR(priv->core_clk), "failed to get core clk\n"); return dev_err_probe(dev, PTR_ERR(priv->core_clk), "failed to get core clk\n");
...@@ -1294,15 +1284,26 @@ static int meson_sar_adc_remove(struct platform_device *pdev) ...@@ -1294,15 +1284,26 @@ static int meson_sar_adc_remove(struct platform_device *pdev)
static int meson_sar_adc_suspend(struct device *dev) static int meson_sar_adc_suspend(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
meson_sar_adc_hw_disable(indio_dev); meson_sar_adc_hw_disable(indio_dev);
clk_disable_unprepare(priv->core_clk);
return 0; return 0;
} }
static int meson_sar_adc_resume(struct device *dev) static int meson_sar_adc_resume(struct device *dev)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev); struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct meson_sar_adc_priv *priv = iio_priv(indio_dev);
int ret;
ret = clk_prepare_enable(priv->core_clk);
if (ret) {
dev_err(dev, "failed to enable core clk\n");
return ret;
}
return meson_sar_adc_hw_enable(indio_dev); return meson_sar_adc_hw_enable(indio_dev);
} }
......
...@@ -253,7 +253,7 @@ int cros_ec_sensors_core_init(struct platform_device *pdev, ...@@ -253,7 +253,7 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
platform_set_drvdata(pdev, indio_dev); platform_set_drvdata(pdev, indio_dev);
state->ec = ec->ec_dev; state->ec = ec->ec_dev;
state->msg = devm_kzalloc(&pdev->dev, state->msg = devm_kzalloc(&pdev->dev, sizeof(*state->msg) +
max((u16)sizeof(struct ec_params_motion_sense), max((u16)sizeof(struct ec_params_motion_sense),
state->ec->max_response), GFP_KERNEL); state->ec->max_response), GFP_KERNEL);
if (!state->msg) if (!state->msg)
......
...@@ -344,9 +344,12 @@ static int admv1013_update_quad_filters(struct admv1013_state *st) ...@@ -344,9 +344,12 @@ static int admv1013_update_quad_filters(struct admv1013_state *st)
static int admv1013_update_mixer_vgate(struct admv1013_state *st) static int admv1013_update_mixer_vgate(struct admv1013_state *st)
{ {
unsigned int vcm, mixer_vgate; unsigned int mixer_vgate;
int vcm;
vcm = regulator_get_voltage(st->reg); vcm = regulator_get_voltage(st->reg);
if (vcm < 0)
return vcm;
if (vcm < 1800000) if (vcm < 1800000)
mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100; mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
......
...@@ -2687,7 +2687,7 @@ static int lsm6dsx_get_acpi_mount_matrix(struct device *dev, ...@@ -2687,7 +2687,7 @@ static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
static int lsm6dsx_get_acpi_mount_matrix(struct device *dev, static int lsm6dsx_get_acpi_mount_matrix(struct device *dev,
struct iio_mount_matrix *orientation) struct iio_mount_matrix *orientation)
{ {
return false; return -EOPNOTSUPP;
} }
#endif #endif
......
...@@ -1888,7 +1888,7 @@ static const struct iio_buffer_setup_ops noop_ring_setup_ops; ...@@ -1888,7 +1888,7 @@ static const struct iio_buffer_setup_ops noop_ring_setup_ops;
int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod) int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
{ {
struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev);
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode = NULL;
int ret; int ret;
if (!indio_dev->info) if (!indio_dev->info)
...@@ -1899,7 +1899,8 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod) ...@@ -1899,7 +1899,8 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
/* If the calling driver did not initialize firmware node, do it here */ /* If the calling driver did not initialize firmware node, do it here */
if (dev_fwnode(&indio_dev->dev)) if (dev_fwnode(&indio_dev->dev))
fwnode = dev_fwnode(&indio_dev->dev); fwnode = dev_fwnode(&indio_dev->dev);
else /* The default dummy IIO device has no parent */
else if (indio_dev->dev.parent)
fwnode = dev_fwnode(indio_dev->dev.parent); fwnode = dev_fwnode(indio_dev->dev.parent);
device_set_node(&indio_dev->dev, fwnode); device_set_node(&indio_dev->dev, fwnode);
......
...@@ -190,7 +190,7 @@ static const struct iio_itime_sel_mul bu27008_itimes[] = { ...@@ -190,7 +190,7 @@ static const struct iio_itime_sel_mul bu27008_itimes[] = {
.address = BU27008_REG_##data##_LO, \ .address = BU27008_REG_##data##_LO, \
.scan_index = BU27008_##color, \ .scan_index = BU27008_##color, \
.scan_type = { \ .scan_type = { \
.sign = 's', \ .sign = 'u', \
.realbits = 16, \ .realbits = 16, \
.storagebits = 16, \ .storagebits = 16, \
.endianness = IIO_LE, \ .endianness = IIO_LE, \
...@@ -633,7 +633,7 @@ static int bu27008_try_find_new_time_gain(struct bu27008_data *data, int val, ...@@ -633,7 +633,7 @@ static int bu27008_try_find_new_time_gain(struct bu27008_data *data, int val,
for (i = 0; i < data->gts.num_itime; i++) { for (i = 0; i < data->gts.num_itime; i++) {
new_time_sel = data->gts.itime_table[i].sel; new_time_sel = data->gts.itime_table[i].sel;
ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts, ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts,
new_time_sel, val, val2 * 1000, gain_sel); new_time_sel, val, val2, gain_sel);
if (!ret) if (!ret)
break; break;
} }
...@@ -662,7 +662,7 @@ static int bu27008_set_scale(struct bu27008_data *data, ...@@ -662,7 +662,7 @@ static int bu27008_set_scale(struct bu27008_data *data,
goto unlock_out; goto unlock_out;
ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts, time_sel, ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts, time_sel,
val, val2 * 1000, &gain_sel); val, val2, &gain_sel);
if (ret) { if (ret) {
ret = bu27008_try_find_new_time_gain(data, val, val2, &gain_sel); ret = bu27008_try_find_new_time_gain(data, val, val2, &gain_sel);
if (ret) if (ret)
...@@ -677,6 +677,21 @@ static int bu27008_set_scale(struct bu27008_data *data, ...@@ -677,6 +677,21 @@ static int bu27008_set_scale(struct bu27008_data *data,
return ret; return ret;
} }
static int bu27008_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{
switch (mask) {
case IIO_CHAN_INFO_SCALE:
return IIO_VAL_INT_PLUS_NANO;
case IIO_CHAN_INFO_INT_TIME:
return IIO_VAL_INT_PLUS_MICRO;
default:
return -EINVAL;
}
}
static int bu27008_write_raw(struct iio_dev *idev, static int bu27008_write_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int val, int val2, long mask) int val, int val2, long mask)
...@@ -756,6 +771,7 @@ static int bu27008_update_scan_mode(struct iio_dev *idev, ...@@ -756,6 +771,7 @@ static int bu27008_update_scan_mode(struct iio_dev *idev,
static const struct iio_info bu27008_info = { static const struct iio_info bu27008_info = {
.read_raw = &bu27008_read_raw, .read_raw = &bu27008_read_raw,
.write_raw = &bu27008_write_raw, .write_raw = &bu27008_write_raw,
.write_raw_get_fmt = &bu27008_write_raw_get_fmt,
.read_avail = &bu27008_read_avail, .read_avail = &bu27008_read_avail,
.update_scan_mode = bu27008_update_scan_mode, .update_scan_mode = bu27008_update_scan_mode,
.validate_trigger = iio_validate_own_trigger, .validate_trigger = iio_validate_own_trigger,
......
...@@ -575,7 +575,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan, ...@@ -575,7 +575,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan,
return -EINVAL; return -EINVAL;
if (chan == BU27034_CHAN_ALS) { if (chan == BU27034_CHAN_ALS) {
if (val == 0 && val2 == 1000) if (val == 0 && val2 == 1000000)
return 0; return 0;
return -EINVAL; return -EINVAL;
...@@ -587,7 +587,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan, ...@@ -587,7 +587,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan,
goto unlock_out; goto unlock_out;
ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts, time_sel, ret = iio_gts_find_gain_sel_for_scale_using_time(&data->gts, time_sel,
val, val2 * 1000, &gain_sel); val, val2, &gain_sel);
if (ret) { if (ret) {
/* /*
* Could not support scale with given time. Need to change time. * Could not support scale with given time. Need to change time.
...@@ -624,7 +624,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan, ...@@ -624,7 +624,7 @@ static int bu27034_set_scale(struct bu27034_data *data, int chan,
/* Can we provide requested scale with this time? */ /* Can we provide requested scale with this time? */
ret = iio_gts_find_gain_sel_for_scale_using_time( ret = iio_gts_find_gain_sel_for_scale_using_time(
&data->gts, new_time_sel, val, val2 * 1000, &data->gts, new_time_sel, val, val2,
&gain_sel); &gain_sel);
if (ret) if (ret)
continue; continue;
...@@ -1217,6 +1217,21 @@ static int bu27034_read_raw(struct iio_dev *idev, ...@@ -1217,6 +1217,21 @@ static int bu27034_read_raw(struct iio_dev *idev,
} }
} }
static int bu27034_write_raw_get_fmt(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
long mask)
{
switch (mask) {
case IIO_CHAN_INFO_SCALE:
return IIO_VAL_INT_PLUS_NANO;
case IIO_CHAN_INFO_INT_TIME:
return IIO_VAL_INT_PLUS_MICRO;
default:
return -EINVAL;
}
}
static int bu27034_write_raw(struct iio_dev *idev, static int bu27034_write_raw(struct iio_dev *idev,
struct iio_chan_spec const *chan, struct iio_chan_spec const *chan,
int val, int val2, long mask) int val, int val2, long mask)
...@@ -1267,6 +1282,7 @@ static int bu27034_read_avail(struct iio_dev *idev, ...@@ -1267,6 +1282,7 @@ static int bu27034_read_avail(struct iio_dev *idev,
static const struct iio_info bu27034_info = { static const struct iio_info bu27034_info = {
.read_raw = &bu27034_read_raw, .read_raw = &bu27034_read_raw,
.write_raw = &bu27034_write_raw, .write_raw = &bu27034_write_raw,
.write_raw_get_fmt = &bu27034_write_raw_get_fmt,
.read_avail = &bu27034_read_avail, .read_avail = &bu27034_read_avail,
}; };
......
...@@ -83,6 +83,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) ...@@ -83,6 +83,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm)
temp = agg_peak[bucket] * bcm->vote_scale; temp = agg_peak[bucket] * bcm->vote_scale;
bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit);
if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) {
bcm->vote_x[bucket] = 0;
bcm->vote_y[bucket] = bcm->enable_mask;
}
} }
if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
......
...@@ -81,6 +81,7 @@ struct qcom_icc_node { ...@@ -81,6 +81,7 @@ struct qcom_icc_node {
* @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm
* @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm
* @vote_scale: scaling factor for vote_x and vote_y * @vote_scale: scaling factor for vote_x and vote_y
* @enable_mask: optional mask to send as vote instead of vote_x/vote_y
* @dirty: flag used to indicate whether the bcm needs to be committed * @dirty: flag used to indicate whether the bcm needs to be committed
* @keepalive: flag used to indicate whether a keepalive is required * @keepalive: flag used to indicate whether a keepalive is required
* @aux_data: auxiliary data used when calculating threshold values and * @aux_data: auxiliary data used when calculating threshold values and
...@@ -97,6 +98,7 @@ struct qcom_icc_bcm { ...@@ -97,6 +98,7 @@ struct qcom_icc_bcm {
u64 vote_x[QCOM_ICC_NUM_BUCKETS]; u64 vote_x[QCOM_ICC_NUM_BUCKETS];
u64 vote_y[QCOM_ICC_NUM_BUCKETS]; u64 vote_y[QCOM_ICC_NUM_BUCKETS];
u64 vote_scale; u64 vote_scale;
u32 enable_mask;
bool dirty; bool dirty;
bool keepalive; bool keepalive;
struct bcm_db aux_data; struct bcm_db aux_data;
......
...@@ -1873,6 +1873,7 @@ static struct qcom_icc_node srvc_snoc = { ...@@ -1873,6 +1873,7 @@ static struct qcom_icc_node srvc_snoc = {
static struct qcom_icc_bcm bcm_acv = { static struct qcom_icc_bcm bcm_acv = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x8,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi }, .nodes = { &ebi },
}; };
......
...@@ -1337,6 +1337,7 @@ static struct qcom_icc_node qns_mem_noc_sf_disp = { ...@@ -1337,6 +1337,7 @@ static struct qcom_icc_node qns_mem_noc_sf_disp = {
static struct qcom_icc_bcm bcm_acv = { static struct qcom_icc_bcm bcm_acv = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x8,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi }, .nodes = { &ebi },
}; };
...@@ -1349,6 +1350,7 @@ static struct qcom_icc_bcm bcm_ce0 = { ...@@ -1349,6 +1350,7 @@ static struct qcom_icc_bcm bcm_ce0 = {
static struct qcom_icc_bcm bcm_cn0 = { static struct qcom_icc_bcm bcm_cn0 = {
.name = "CN0", .name = "CN0",
.enable_mask = 0x1,
.keepalive = true, .keepalive = true,
.num_nodes = 55, .num_nodes = 55,
.nodes = { &qnm_gemnoc_cnoc, &qnm_gemnoc_pcie, .nodes = { &qnm_gemnoc_cnoc, &qnm_gemnoc_pcie,
...@@ -1383,6 +1385,7 @@ static struct qcom_icc_bcm bcm_cn0 = { ...@@ -1383,6 +1385,7 @@ static struct qcom_icc_bcm bcm_cn0 = {
static struct qcom_icc_bcm bcm_co0 = { static struct qcom_icc_bcm bcm_co0 = {
.name = "CO0", .name = "CO0",
.enable_mask = 0x1,
.num_nodes = 2, .num_nodes = 2,
.nodes = { &qxm_nsp, &qns_nsp_gemnoc }, .nodes = { &qxm_nsp, &qns_nsp_gemnoc },
}; };
...@@ -1403,6 +1406,7 @@ static struct qcom_icc_bcm bcm_mm0 = { ...@@ -1403,6 +1406,7 @@ static struct qcom_icc_bcm bcm_mm0 = {
static struct qcom_icc_bcm bcm_mm1 = { static struct qcom_icc_bcm bcm_mm1 = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 12, .num_nodes = 12,
.nodes = { &qnm_camnoc_hf, &qnm_camnoc_icp, .nodes = { &qnm_camnoc_hf, &qnm_camnoc_icp,
&qnm_camnoc_sf, &qnm_mdp, &qnm_camnoc_sf, &qnm_mdp,
...@@ -1445,6 +1449,7 @@ static struct qcom_icc_bcm bcm_sh0 = { ...@@ -1445,6 +1449,7 @@ static struct qcom_icc_bcm bcm_sh0 = {
static struct qcom_icc_bcm bcm_sh1 = { static struct qcom_icc_bcm bcm_sh1 = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 7, .num_nodes = 7,
.nodes = { &alm_gpu_tcu, &alm_sys_tcu, .nodes = { &alm_gpu_tcu, &alm_sys_tcu,
&qnm_nsp_gemnoc, &qnm_pcie, &qnm_nsp_gemnoc, &qnm_pcie,
...@@ -1461,6 +1466,7 @@ static struct qcom_icc_bcm bcm_sn0 = { ...@@ -1461,6 +1466,7 @@ static struct qcom_icc_bcm bcm_sn0 = {
static struct qcom_icc_bcm bcm_sn1 = { static struct qcom_icc_bcm bcm_sn1 = {
.name = "SN1", .name = "SN1",
.enable_mask = 0x1,
.num_nodes = 4, .num_nodes = 4,
.nodes = { &qhm_gic, &qxm_pimem, .nodes = { &qhm_gic, &qxm_pimem,
&xm_gic, &qns_gemnoc_gc }, &xm_gic, &qns_gemnoc_gc },
...@@ -1492,6 +1498,7 @@ static struct qcom_icc_bcm bcm_sn7 = { ...@@ -1492,6 +1498,7 @@ static struct qcom_icc_bcm bcm_sn7 = {
static struct qcom_icc_bcm bcm_acv_disp = { static struct qcom_icc_bcm bcm_acv_disp = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x1,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi_disp }, .nodes = { &ebi_disp },
}; };
...@@ -1510,6 +1517,7 @@ static struct qcom_icc_bcm bcm_mm0_disp = { ...@@ -1510,6 +1517,7 @@ static struct qcom_icc_bcm bcm_mm0_disp = {
static struct qcom_icc_bcm bcm_mm1_disp = { static struct qcom_icc_bcm bcm_mm1_disp = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 3, .num_nodes = 3,
.nodes = { &qnm_mdp_disp, &qnm_rot_disp, .nodes = { &qnm_mdp_disp, &qnm_rot_disp,
&qns_mem_noc_sf_disp }, &qns_mem_noc_sf_disp },
...@@ -1523,6 +1531,7 @@ static struct qcom_icc_bcm bcm_sh0_disp = { ...@@ -1523,6 +1531,7 @@ static struct qcom_icc_bcm bcm_sh0_disp = {
static struct qcom_icc_bcm bcm_sh1_disp = { static struct qcom_icc_bcm bcm_sh1_disp = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &qnm_pcie_disp }, .nodes = { &qnm_pcie_disp },
}; };
......
...@@ -1473,6 +1473,7 @@ static struct qcom_icc_node qns_mem_noc_sf_cam_ife_2 = { ...@@ -1473,6 +1473,7 @@ static struct qcom_icc_node qns_mem_noc_sf_cam_ife_2 = {
static struct qcom_icc_bcm bcm_acv = { static struct qcom_icc_bcm bcm_acv = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x8,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi }, .nodes = { &ebi },
}; };
...@@ -1485,6 +1486,7 @@ static struct qcom_icc_bcm bcm_ce0 = { ...@@ -1485,6 +1486,7 @@ static struct qcom_icc_bcm bcm_ce0 = {
static struct qcom_icc_bcm bcm_cn0 = { static struct qcom_icc_bcm bcm_cn0 = {
.name = "CN0", .name = "CN0",
.enable_mask = 0x1,
.keepalive = true, .keepalive = true,
.num_nodes = 54, .num_nodes = 54,
.nodes = { &qsm_cfg, &qhs_ahb2phy0, .nodes = { &qsm_cfg, &qhs_ahb2phy0,
...@@ -1524,6 +1526,7 @@ static struct qcom_icc_bcm bcm_cn1 = { ...@@ -1524,6 +1526,7 @@ static struct qcom_icc_bcm bcm_cn1 = {
static struct qcom_icc_bcm bcm_co0 = { static struct qcom_icc_bcm bcm_co0 = {
.name = "CO0", .name = "CO0",
.enable_mask = 0x1,
.num_nodes = 2, .num_nodes = 2,
.nodes = { &qxm_nsp, &qns_nsp_gemnoc }, .nodes = { &qxm_nsp, &qns_nsp_gemnoc },
}; };
...@@ -1549,6 +1552,7 @@ static struct qcom_icc_bcm bcm_mm0 = { ...@@ -1549,6 +1552,7 @@ static struct qcom_icc_bcm bcm_mm0 = {
static struct qcom_icc_bcm bcm_mm1 = { static struct qcom_icc_bcm bcm_mm1 = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 8, .num_nodes = 8,
.nodes = { &qnm_camnoc_hf, &qnm_camnoc_icp, .nodes = { &qnm_camnoc_hf, &qnm_camnoc_icp,
&qnm_camnoc_sf, &qnm_vapss_hcp, &qnm_camnoc_sf, &qnm_vapss_hcp,
...@@ -1589,6 +1593,7 @@ static struct qcom_icc_bcm bcm_sh0 = { ...@@ -1589,6 +1593,7 @@ static struct qcom_icc_bcm bcm_sh0 = {
static struct qcom_icc_bcm bcm_sh1 = { static struct qcom_icc_bcm bcm_sh1 = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 13, .num_nodes = 13,
.nodes = { &alm_gpu_tcu, &alm_sys_tcu, .nodes = { &alm_gpu_tcu, &alm_sys_tcu,
&chm_apps, &qnm_gpu, &chm_apps, &qnm_gpu,
...@@ -1608,6 +1613,7 @@ static struct qcom_icc_bcm bcm_sn0 = { ...@@ -1608,6 +1613,7 @@ static struct qcom_icc_bcm bcm_sn0 = {
static struct qcom_icc_bcm bcm_sn1 = { static struct qcom_icc_bcm bcm_sn1 = {
.name = "SN1", .name = "SN1",
.enable_mask = 0x1,
.num_nodes = 3, .num_nodes = 3,
.nodes = { &qhm_gic, &xm_gic, .nodes = { &qhm_gic, &xm_gic,
&qns_gemnoc_gc }, &qns_gemnoc_gc },
...@@ -1633,6 +1639,7 @@ static struct qcom_icc_bcm bcm_sn7 = { ...@@ -1633,6 +1639,7 @@ static struct qcom_icc_bcm bcm_sn7 = {
static struct qcom_icc_bcm bcm_acv_disp = { static struct qcom_icc_bcm bcm_acv_disp = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x1,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi_disp }, .nodes = { &ebi_disp },
}; };
...@@ -1657,12 +1664,14 @@ static struct qcom_icc_bcm bcm_sh0_disp = { ...@@ -1657,12 +1664,14 @@ static struct qcom_icc_bcm bcm_sh0_disp = {
static struct qcom_icc_bcm bcm_sh1_disp = { static struct qcom_icc_bcm bcm_sh1_disp = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 2, .num_nodes = 2,
.nodes = { &qnm_mnoc_hf_disp, &qnm_pcie_disp }, .nodes = { &qnm_mnoc_hf_disp, &qnm_pcie_disp },
}; };
static struct qcom_icc_bcm bcm_acv_cam_ife_0 = { static struct qcom_icc_bcm bcm_acv_cam_ife_0 = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x0,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi_cam_ife_0 }, .nodes = { &ebi_cam_ife_0 },
}; };
...@@ -1681,6 +1690,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_0 = { ...@@ -1681,6 +1690,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_0 = {
static struct qcom_icc_bcm bcm_mm1_cam_ife_0 = { static struct qcom_icc_bcm bcm_mm1_cam_ife_0 = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 4, .num_nodes = 4,
.nodes = { &qnm_camnoc_hf_cam_ife_0, &qnm_camnoc_icp_cam_ife_0, .nodes = { &qnm_camnoc_hf_cam_ife_0, &qnm_camnoc_icp_cam_ife_0,
&qnm_camnoc_sf_cam_ife_0, &qns_mem_noc_sf_cam_ife_0 }, &qnm_camnoc_sf_cam_ife_0, &qns_mem_noc_sf_cam_ife_0 },
...@@ -1694,6 +1704,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_0 = { ...@@ -1694,6 +1704,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_0 = {
static struct qcom_icc_bcm bcm_sh1_cam_ife_0 = { static struct qcom_icc_bcm bcm_sh1_cam_ife_0 = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 3, .num_nodes = 3,
.nodes = { &qnm_mnoc_hf_cam_ife_0, &qnm_mnoc_sf_cam_ife_0, .nodes = { &qnm_mnoc_hf_cam_ife_0, &qnm_mnoc_sf_cam_ife_0,
&qnm_pcie_cam_ife_0 }, &qnm_pcie_cam_ife_0 },
...@@ -1701,6 +1712,7 @@ static struct qcom_icc_bcm bcm_sh1_cam_ife_0 = { ...@@ -1701,6 +1712,7 @@ static struct qcom_icc_bcm bcm_sh1_cam_ife_0 = {
static struct qcom_icc_bcm bcm_acv_cam_ife_1 = { static struct qcom_icc_bcm bcm_acv_cam_ife_1 = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x0,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi_cam_ife_1 }, .nodes = { &ebi_cam_ife_1 },
}; };
...@@ -1719,6 +1731,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_1 = { ...@@ -1719,6 +1731,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_1 = {
static struct qcom_icc_bcm bcm_mm1_cam_ife_1 = { static struct qcom_icc_bcm bcm_mm1_cam_ife_1 = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 4, .num_nodes = 4,
.nodes = { &qnm_camnoc_hf_cam_ife_1, &qnm_camnoc_icp_cam_ife_1, .nodes = { &qnm_camnoc_hf_cam_ife_1, &qnm_camnoc_icp_cam_ife_1,
&qnm_camnoc_sf_cam_ife_1, &qns_mem_noc_sf_cam_ife_1 }, &qnm_camnoc_sf_cam_ife_1, &qns_mem_noc_sf_cam_ife_1 },
...@@ -1732,6 +1745,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_1 = { ...@@ -1732,6 +1745,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_1 = {
static struct qcom_icc_bcm bcm_sh1_cam_ife_1 = { static struct qcom_icc_bcm bcm_sh1_cam_ife_1 = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 3, .num_nodes = 3,
.nodes = { &qnm_mnoc_hf_cam_ife_1, &qnm_mnoc_sf_cam_ife_1, .nodes = { &qnm_mnoc_hf_cam_ife_1, &qnm_mnoc_sf_cam_ife_1,
&qnm_pcie_cam_ife_1 }, &qnm_pcie_cam_ife_1 },
...@@ -1739,6 +1753,7 @@ static struct qcom_icc_bcm bcm_sh1_cam_ife_1 = { ...@@ -1739,6 +1753,7 @@ static struct qcom_icc_bcm bcm_sh1_cam_ife_1 = {
static struct qcom_icc_bcm bcm_acv_cam_ife_2 = { static struct qcom_icc_bcm bcm_acv_cam_ife_2 = {
.name = "ACV", .name = "ACV",
.enable_mask = 0x0,
.num_nodes = 1, .num_nodes = 1,
.nodes = { &ebi_cam_ife_2 }, .nodes = { &ebi_cam_ife_2 },
}; };
...@@ -1757,6 +1772,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_2 = { ...@@ -1757,6 +1772,7 @@ static struct qcom_icc_bcm bcm_mm0_cam_ife_2 = {
static struct qcom_icc_bcm bcm_mm1_cam_ife_2 = { static struct qcom_icc_bcm bcm_mm1_cam_ife_2 = {
.name = "MM1", .name = "MM1",
.enable_mask = 0x1,
.num_nodes = 4, .num_nodes = 4,
.nodes = { &qnm_camnoc_hf_cam_ife_2, &qnm_camnoc_icp_cam_ife_2, .nodes = { &qnm_camnoc_hf_cam_ife_2, &qnm_camnoc_icp_cam_ife_2,
&qnm_camnoc_sf_cam_ife_2, &qns_mem_noc_sf_cam_ife_2 }, &qnm_camnoc_sf_cam_ife_2, &qns_mem_noc_sf_cam_ife_2 },
...@@ -1770,6 +1786,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_2 = { ...@@ -1770,6 +1786,7 @@ static struct qcom_icc_bcm bcm_sh0_cam_ife_2 = {
static struct qcom_icc_bcm bcm_sh1_cam_ife_2 = { static struct qcom_icc_bcm bcm_sh1_cam_ife_2 = {
.name = "SH1", .name = "SH1",
.enable_mask = 0x1,
.num_nodes = 3, .num_nodes = 3,
.nodes = { &qnm_mnoc_hf_cam_ife_2, &qnm_mnoc_sf_cam_ife_2, .nodes = { &qnm_mnoc_hf_cam_ife_2, &qnm_mnoc_sf_cam_ife_2,
&qnm_pcie_cam_ife_2 }, &qnm_pcie_cam_ife_2 },
......
...@@ -195,7 +195,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) ...@@ -195,7 +195,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
} }
} }
if (option->force_clkreq_0) if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG, rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
else else
......
...@@ -435,17 +435,10 @@ static void rts5228_init_from_cfg(struct rtsx_pcr *pcr) ...@@ -435,17 +435,10 @@ static void rts5228_init_from_cfg(struct rtsx_pcr *pcr)
option->ltr_enabled = false; option->ltr_enabled = false;
} }
} }
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
| PM_L1_1_EN | PM_L1_2_EN))
option->force_clkreq_0 = false;
else
option->force_clkreq_0 = true;
} }
static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
{ {
struct rtsx_cr_option *option = &pcr->option;
rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1, rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1,
CD_RESUME_EN_MASK, CD_RESUME_EN_MASK); CD_RESUME_EN_MASK, CD_RESUME_EN_MASK);
...@@ -476,17 +469,6 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) ...@@ -476,17 +469,6 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
else else
rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
/*
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
* to drive low, and we forcibly request clock.
*/
if (option->force_clkreq_0)
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
else
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
if (pcr->rtd3_en) { if (pcr->rtd3_en) {
......
...@@ -327,12 +327,11 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) ...@@ -327,12 +327,11 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
} }
} }
/* /*
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
* to drive low, and we forcibly request clock. * to drive low, and we forcibly request clock.
*/ */
if (option->force_clkreq_0) if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
rtsx_pci_write_register(pcr, PETXCFG, rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW); FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
else else
......
...@@ -517,17 +517,10 @@ static void rts5260_init_from_cfg(struct rtsx_pcr *pcr) ...@@ -517,17 +517,10 @@ static void rts5260_init_from_cfg(struct rtsx_pcr *pcr)
option->ltr_enabled = false; option->ltr_enabled = false;
} }
} }
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
| PM_L1_1_EN | PM_L1_2_EN))
option->force_clkreq_0 = false;
else
option->force_clkreq_0 = true;
} }
static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
{ {
struct rtsx_cr_option *option = &pcr->option;
/* Set mcu_cnt to 7 to ensure data can be sampled properly */ /* Set mcu_cnt to 7 to ensure data can be sampled properly */
rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07); rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07);
...@@ -546,17 +539,6 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) ...@@ -546,17 +539,6 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
rts5260_init_hw(pcr); rts5260_init_hw(pcr);
/*
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
* to drive low, and we forcibly request clock.
*/
if (option->force_clkreq_0)
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
else
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00); rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00);
return 0; return 0;
......
...@@ -498,17 +498,10 @@ static void rts5261_init_from_cfg(struct rtsx_pcr *pcr) ...@@ -498,17 +498,10 @@ static void rts5261_init_from_cfg(struct rtsx_pcr *pcr)
option->ltr_enabled = false; option->ltr_enabled = false;
} }
} }
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
| PM_L1_1_EN | PM_L1_2_EN))
option->force_clkreq_0 = false;
else
option->force_clkreq_0 = true;
} }
static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
{ {
struct rtsx_cr_option *option = &pcr->option;
u32 val; u32 val;
rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1, rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1,
...@@ -554,17 +547,6 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) ...@@ -554,17 +547,6 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
else else
rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
/*
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
* to drive low, and we forcibly request clock.
*/
if (option->force_clkreq_0)
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
else
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
if (pcr->rtd3_en) { if (pcr->rtd3_en) {
......
...@@ -1326,8 +1326,11 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) ...@@ -1326,8 +1326,11 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
return err; return err;
} }
if (pcr->aspm_mode == ASPM_MODE_REG) if (pcr->aspm_mode == ASPM_MODE_REG) {
rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30); rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
rtsx_pci_write_register(pcr, PETXCFG,
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
}
/* No CD interrupt if probing driver with card inserted. /* No CD interrupt if probing driver with card inserted.
* So we need to initialize pcr->card_exist here. * So we need to initialize pcr->card_exist here.
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <linux/mfd/tps6594.h> #include <linux/mfd/tps6594.h>
#define TPS6594_DEV_REV_1 0x08
static irqreturn_t tps6594_esm_isr(int irq, void *dev_id) static irqreturn_t tps6594_esm_isr(int irq, void *dev_id)
{ {
struct platform_device *pdev = dev_id; struct platform_device *pdev = dev_id;
...@@ -32,11 +34,26 @@ static int tps6594_esm_probe(struct platform_device *pdev) ...@@ -32,11 +34,26 @@ static int tps6594_esm_probe(struct platform_device *pdev)
{ {
struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent); struct tps6594 *tps = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
unsigned int rev;
int irq; int irq;
int ret; int ret;
int i; int i;
for (i = 0 ; i < pdev->num_resources ; i++) { /*
* Due to a bug in revision 1 of the PMIC, the GPIO3 used for the
* SoC ESM function is used to power the load switch instead.
* As a consequence, ESM can not be used on those PMIC.
* Check the version and return an error in case of revision 1.
*/
ret = regmap_read(tps->regmap, TPS6594_REG_DEV_REV, &rev);
if (ret)
return dev_err_probe(dev, ret,
"Failed to read PMIC revision\n");
if (rev == TPS6594_DEV_REV_1)
return dev_err_probe(dev, -ENODEV,
"ESM not supported for revision 1 PMIC\n");
for (i = 0; i < pdev->num_resources; i++) {
irq = platform_get_irq_byname(pdev, pdev->resource[i].name); irq = platform_get_irq_byname(pdev, pdev->resource[i].name);
if (irq < 0) if (irq < 0)
return dev_err_probe(dev, irq, "Failed to get %s irq\n", return dev_err_probe(dev, irq, "Failed to get %s irq\n",
......
...@@ -40,7 +40,8 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE) ...@@ -40,7 +40,8 @@ $(OUTPUT)counter_example: $(COUNTER_EXAMPLE)
clean: clean:
rm -f $(ALL_PROGRAMS) rm -f $(ALL_PROGRAMS)
rm -rf $(OUTPUT)include/linux/counter.h rm -rf $(OUTPUT)include/linux/counter.h
rmdir -p $(OUTPUT)include/linux rm -df $(OUTPUT)include/linux
rm -df $(OUTPUT)include
find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete
install: $(ALL_PROGRAMS) install: $(ALL_PROGRAMS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment