RE: [PATCH 2/4] input: misc: da9063_onkey: add mode change support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 September 2019 15:04, Marco Felsch wrote:

> The pmic state machine behaviour upon a 'onkey press' event can be
> configured using the ONKEY_PIN bit field. Most the time this is
> configured correct by the OTP but sometimes we need to adjust the
> behaviour so we need to add the support here.
> 
> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> ---
>  drivers/input/misc/da9063_onkey.c | 10 ++++++++++
>  drivers/mfd/da9062-core.c         |  1 +
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/input/misc/da9063_onkey.c
> b/drivers/input/misc/da9063_onkey.c
> index fd355cf59397..bc982fcc87eb 100644
> --- a/drivers/input/misc/da9063_onkey.c
> +++ b/drivers/input/misc/da9063_onkey.c
> @@ -40,6 +40,7 @@ struct da9063_onkey {
>  	const struct da906x_chip_config *config;
>  	char phys[32];
>  	bool key_power;
> +	u8 key_opmode;
>  };
> 
>  static const struct da906x_chip_config da9063_regs = {
> @@ -193,6 +194,7 @@ static int da9063_onkey_probe(struct platform_device
> *pdev)
>  {
>  	struct da9063_onkey *onkey;
>  	const struct of_device_id *match;
> +	unsigned int val;
>  	int irq;
>  	int error;
> 
> @@ -220,6 +222,14 @@ static int da9063_onkey_probe(struct platform_device
> *pdev)
>  	onkey->key_power = !of_property_read_bool(pdev->dev.of_node,
>  						  "dlg,disable-key-power");
> 
> +	if (!of_property_read_u32(pdev->dev.of_node, "dlg,key-opmode",
> &val)) {
> +		error = regmap_update_bits(onkey->regmap,
> DA9062AA_CONFIG_I,
> +					   DA9062AA_NONKEY_PIN_MASK,
> +					   val << DA9062AA_NONKEY_PIN_SHIFT);
> +		if (error)
> +			return error;
> +	}
> +

This driver is used to cover DA9061, DA9062 and DA9063. This binding therefore
can apply to any of those as there's no checking of which device is being used.
For DA9063 usage, if this option is present then the probe will fail as your
regmap range update below only takes care of DA9061/2.

Ideally I think you should update the da906x_chip_config structure for this to
support all devices as I believe the same or similar options are available for
DA9063.

>  	onkey->input = devm_input_allocate_device(&pdev->dev);
>  	if (!onkey->input) {
>  		dev_err(&pdev->dev, "Failed to allocated input device.\n");
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index e69626867c26..aaa1f1841bc3 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -510,6 +510,7 @@ static const struct regmap_range
> da9062_aa_writeable_ranges[] = {
>  	regmap_reg_range(DA9062AA_VLDO1_B, DA9062AA_VLDO4_B),
>  	regmap_reg_range(DA9062AA_BBAT_CONT, DA9062AA_BBAT_CONT),
>  	regmap_reg_range(DA9062AA_GP_ID_0, DA9062AA_GP_ID_19),
> +	regmap_reg_range(DA9062AA_CONFIG_I, DA9062AA_CONFIG_I),
>  };
> 
>  static const struct regmap_range da9062_aa_volatile_ranges[] = {
> --
> 2.20.1





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux