Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1414143 > unrolled thread

Re: [PATCH 1/2][v3] i2c: qup: add ACPI support

Started byAndy Gross <andy.gross@linaro.org>
First post2016-06-05 21:00 +0200
Last post2016-06-08 20:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2][v3] i2c: qup: add ACPI support Andy Gross <andy.gross@linaro.org> - 2016-06-05 21:00 +0200
    Re: [PATCH 1/2][v3] i2c: qup: add ACPI support "Christ, Austin" <austinwc@codeaurora.org> - 2016-06-08 20:20 +0200

#1414143 — Re: [PATCH 1/2][v3] i2c: qup: add ACPI support

FromAndy Gross <andy.gross@linaro.org>
Date2016-06-05 21:00 +0200
SubjectRe: [PATCH 1/2][v3] i2c: qup: add ACPI support
Message-ID<rGLrc-21Z-11@gated-at.bofh.it>
On Thu, May 26, 2016 at 01:37:56PM -0600, Austin Christ wrote:

<snip>

> @@ -1354,14 +1359,13 @@ static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup)
>  static int qup_i2c_probe(struct platform_device *pdev)
>  {
>  	static const int blk_sizes[] = {4, 16, 32};
> -	struct device_node *node = pdev->dev.of_node;
>  	struct qup_i2c_dev *qup;
>  	unsigned long one_bit_t;
>  	struct resource *res;
>  	u32 io_mode, hw_ver, size;
>  	int ret, fs_div, hs_div;
> -	int src_clk_freq;
> -	u32 clk_freq = 100000;
> +	u32 src_clk_freq = 0;
> +	u32 clk_freq = 0;
>  	int blocks;
>  
>  	qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL);
> @@ -1372,7 +1376,12 @@ static int qup_i2c_probe(struct platform_device *pdev)
>  	init_completion(&qup->xfer);
>  	platform_set_drvdata(pdev, qup);
>  
> -	of_property_read_u32(node, "clock-frequency", &clk_freq);
> +	ret = device_property_read_u32(qup->dev, "clock-frequency", &clk_freq);

Why do we need a warning if the clock-frequency is not specified?  It is
optional in the DT documentation, is it not in the ACPI?

> +	if (ret) {
> +		dev_warn(qup->dev, "using default clock-frequency %d",
> +			DEFAULT_CLK_FREQ);
> +		clk_freq = DEFAULT_CLK_FREQ;

You could just assign the DEFAULT_CLK_FREQ in the variable declaration instead
of 0.  read_property does not modify the variable unless it finds it or does the
ACPI version modify if not found?

> +	}
>  
>  	if (of_device_is_compatible(pdev->dev.of_node, "qcom,i2c-qup-v1.1.1")) {
>  		qup->adap.algo = &qup_i2c_algo;
> @@ -1454,20 +1463,31 @@ nodma:
>  		return qup->irq;
>  	}
>  

<snip>

Regards,

Andy

[toc] | [next] | [standalone]


#1417748

From"Christ, Austin" <austinwc@codeaurora.org>
Date2016-06-08 20:20 +0200
Message-ID<rHQf7-3Ci-7@gated-at.bofh.it>
In reply to#1414143
On 6/5/2016 12:57 PM, Andy Gross wrote:
> On Thu, May 26, 2016 at 01:37:56PM -0600, Austin Christ wrote:
>
> <snip>
>
>> @@ -1354,14 +1359,13 @@ static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup)
>>   static int qup_i2c_probe(struct platform_device *pdev)
>>   {
>>   	static const int blk_sizes[] = {4, 16, 32};
>> -	struct device_node *node = pdev->dev.of_node;
>>   	struct qup_i2c_dev *qup;
>>   	unsigned long one_bit_t;
>>   	struct resource *res;
>>   	u32 io_mode, hw_ver, size;
>>   	int ret, fs_div, hs_div;
>> -	int src_clk_freq;
>> -	u32 clk_freq = 100000;
>> +	u32 src_clk_freq = 0;
>> +	u32 clk_freq = 0;
>>   	int blocks;
>>   
>>   	qup = devm_kzalloc(&pdev->dev, sizeof(*qup), GFP_KERNEL);
>> @@ -1372,7 +1376,12 @@ static int qup_i2c_probe(struct platform_device *pdev)
>>   	init_completion(&qup->xfer);
>>   	platform_set_drvdata(pdev, qup);
>>   
>> -	of_property_read_u32(node, "clock-frequency", &clk_freq);
>> +	ret = device_property_read_u32(qup->dev, "clock-frequency", &clk_freq);
> Why do we need a warning if the clock-frequency is not specified?  It is
> optional in the DT documentation, is it not in the ACPI?
I agree a warning is too strong here. The information may still be 
useful about the driver configuration, so I will change it to a 
dev_notify() in v4.
>
>> +	if (ret) {
>> +		dev_warn(qup->dev, "using default clock-frequency %d",
>> +			DEFAULT_CLK_FREQ);
>> +		clk_freq = DEFAULT_CLK_FREQ;
> You could just assign the DEFAULT_CLK_FREQ in the variable declaration instead
> of 0.  read_property does not modify the variable unless it finds it or does the
> ACPI version modify if not found?
You are correct about this function only modifying when it finds a 
value. This will be corrected in v4.
>
>> +	}
>>   
>>   	if (of_device_is_compatible(pdev->dev.of_node, "qcom,i2c-qup-v1.1.1")) {
>>   		qup->adap.algo = &qup_i2c_algo;
>> @@ -1454,20 +1463,31 @@ nodma:
>>   		return qup->irq;
>>   	}
>>   
> <snip>
>
> Regards,
>
> Andy
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks,
Austin

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web